Pass a ScrollTimeline instance to the Animation() constructor or the animate() method to specify it as the timeline that will control the progress of the animation.
Returns an enumerated value representing the scroll axis that is driving the progress of the timeline.
Instance methods
This interface inherits the methods of its parent, AnimationTimeline.
Examples
Displaying the source and axis of a scroll progress timeline
In this example, we animate an element with a class of box along a view progress timeline — it animates across the screen as the document scrolls. We output the source element and scroll axis to an output element in the top-right corner.
In the JavaScript, we grab references to the box and output<div>s, then create a new ScrollTimeline, specifying that the element that will drive the scroll timeline progress is the document (<html>) element, and the scroll axis is the block axis. We then animate the box element with the Web Animations API. Last of all, we display the source element and axis in the output element.