Transitions and Timing
Animate between states with transitions.
Transitions and Timing is a free Angular Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Angular Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Animating Between States
States describe where the element rests; transitions describe how it moves between them. The transition function pairs a state change with an animation.
The transition Function
transition takes a state-change expression and one or more animation steps.
transition('closed => open', animate('300ms'))Direction Operators
Use => for one direction and <=> for both directions.
transition('open <=> closed', animate('250ms ease-in-out'))The animate Function
animate defines timing: duration, optional delay, and easing. The string format is "duration delay easing".
animate('500ms 100ms ease-out')Duration Units
Durations accept ms or s. A bare number is treated as milliseconds.
animate('0.4s')
animate('400ms')
animate(400)Easing Functions
Easing controls acceleration: linear, ease, ease-in, ease-out, ease-in-out, or a cubic-bezier().
animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)')Inline Target Styles
animate can take a second style argument to animate toward styles not tied to a named state.
transition('* => active', [
animate('300ms', style({ transform: 'scale(1.1)' }))
])Multiple Steps
Pass an array of steps to run a sequence within a single transition.
transition('closed => open', [
style({ opacity: 0 }),
animate('300ms', style({ opacity: 1 }))
])Wildcard Transitions
Use * to match transitions from or to any state, handy for generic enter effects.
transition('* => open', animate('200ms'))Starting Styles
A bare style() before animate() sets the starting point, then Angular animates to the destination state styles.
transition(':enter', [
style({ opacity: 0 }),
animate('400ms', style({ opacity: 1 }))
])Timing Best Practices
Keep UI transitions short (150-300ms) for responsiveness. Reserve longer durations for large, intentional motion. Match easing to the feel you want.
Quick Check
Test your understanding of transitions and timing.
Recap
You learned that transition connects state changes (with => or <=>) to animate steps. The timing string is duration delay easing, and you can chain style/animate steps for sequences.
Frequently asked questions
Is the “Transitions and Timing” lesson free?
Yes — the full text of “Transitions and Timing” is free to read here on the web, and the Angular Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Angular Academy course, upgrade to CoddyKit PRO.
What will I learn in “Transitions and Timing”?
Animate between states with transitions. You practise Angular Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Angular Academy?
No prior experience is required. Angular Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Transitions and Timing” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Angular Academy lesson?
Yes. Every Angular Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Animation Basics: trigger and state
- Transitions and Timing
- Enter and Leave Animations
- Keyframes and Staggering