Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Chaining and Sequencing Multiple Animations | Mastering Transforms and Animations
CSS Animations and Transitions

bookChaining and Sequencing Multiple Animations

Combining multiple animations on a single element allows you to create sophisticated, engaging effects that go far beyond simple transitions. By chaining animations—using several @keyframes rules and carefully coordinating their timing, delays, and properties—you can guide the user's attention and create a more dynamic interface.

This approach is especially useful for interactive UI elements like banners, modals, or notifications, where you might want an element to appear, animate in a certain way, and then exit or settle into place with a flourish.

index.html

index.html

styles.css

styles.css

copy

To achieve a complex effect like the animated notification banner, you need to sequence multiple animations so that each one starts at the right time and does not interfere with the others. In the example, three separate animations are applied to the notification-banner element using the animation shorthand property.

  • The first animation, slideIn, moves the banner into view from above. This animation starts immediately and lasts for 0.4s;
  • The second animation, fadeIn, controls the opacity. It starts after a 0.4s delay (so it begins as soon as slideIn finishes) and also runs for 0.4s;
  • The third animation, bounce, adds a playful bounce effect to the banner after it has fully appeared. This animation starts after a 0.8s delay, giving enough time for both the slide and fade to complete, and lasts for 0.5s.

Each animation is defined with its own @keyframes rule to control a specific property: slideIn for vertical movement, fadeIn for opacity, and bounce for the final bounce.

question mark

Which of the following statements about the notification banner animation is correct?

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 3

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Awesome!

Completion rate improved to 8.33

bookChaining and Sequencing Multiple Animations

Glissez pour afficher le menu

Combining multiple animations on a single element allows you to create sophisticated, engaging effects that go far beyond simple transitions. By chaining animations—using several @keyframes rules and carefully coordinating their timing, delays, and properties—you can guide the user's attention and create a more dynamic interface.

This approach is especially useful for interactive UI elements like banners, modals, or notifications, where you might want an element to appear, animate in a certain way, and then exit or settle into place with a flourish.

index.html

index.html

styles.css

styles.css

copy

To achieve a complex effect like the animated notification banner, you need to sequence multiple animations so that each one starts at the right time and does not interfere with the others. In the example, three separate animations are applied to the notification-banner element using the animation shorthand property.

  • The first animation, slideIn, moves the banner into view from above. This animation starts immediately and lasts for 0.4s;
  • The second animation, fadeIn, controls the opacity. It starts after a 0.4s delay (so it begins as soon as slideIn finishes) and also runs for 0.4s;
  • The third animation, bounce, adds a playful bounce effect to the banner after it has fully appeared. This animation starts after a 0.8s delay, giving enough time for both the slide and fade to complete, and lasts for 0.5s.

Each animation is defined with its own @keyframes rule to control a specific property: slideIn for vertical movement, fadeIn for opacity, and bounce for the final bounce.

question mark

Which of the following statements about the notification banner animation is correct?

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 2. Chapitre 3
some-alt