CSS animation triggers
The CSS animation triggers module provides functionality to trigger standard time-based CSS animations when a specific timeline trigger occurs.
Scroll-triggered animations allow you to control when a regular time-based animation starts, pauses, or stops based on when a trigger activates or deactivates, without using JavaScript. This could include when a scrolling element enters or leaves a timeline range.
These ranges normally come from view progress timelines, enabling, for example, an animation to start when an element enters a scrollport and pause when it leaves the scrollport. Properties let you change the timeline range and control the active and activation ranges. Triggers can specify different actions when entering versus exiting the timeline range, allowing control over animation playback.
The animation triggers module also defines event triggers. When supported, these will activate timeline-based animations when specific DOM events occur.
Animation triggers in action
This example demonstrates scroll-triggered animations. Scroll the box up and down — the appearance of the "bouncer" text will trigger the ball's animation, and its disappearance will trigger the same animation in reverse. Scroll further, and the same process will repeat when the "another bouncer" text appears and then disappears from the scrollport.
We defined the animation triggers by specifying a timeline-trigger-name and timeline-trigger-source on the "bouncer" elements. The ball has a bouncing animation set on it twice. It also has an animation-trigger property set: this references the names of both triggers and the actions to perform when the animations are activated and deactivated. Activation and deactivation are caused by the "bouncer" elements coming into and out of view.
Reference
>Properties
animation-triggertimeline-triggershorthandtimeline-trigger-activation-rangeshorthandtimeline-trigger-active-rangeshorthandtimeline-trigger-nametimeline-trigger-sourcetrigger-scope
The CSS animation triggers module also introduces the event-trigger, event-trigger-name, and event-trigger-source properties. Currently, no browsers support these features.
Data types and values
Guides
- Using CSS scroll-triggered animations
-
An introduction to implementing CSS scroll-triggered animations.
- Timeline range names
-
The
<timeline-range-name>data type: Understanding the various timeline range names. - Understanding timeline insets
-
Understanding the animation attachment range syntax used to inset scroll-driven and scroll-triggered animations.
Related concepts
- CSS animations module
- CSS scroll-driven animations module
Specifications
| Specification |
|---|
| Animation Triggers> |
See also
- Using CSS animations
- Using scroll driven animations
- CSS scroll-driven animation timelines
- CSS scroll-triggered animations are coming! on developer.chrome.com (2025)