ScrollTimeline Class

A scroll progress timeline (https://drafts.csswg.org/scroll-animations-1/#scrolltimeline-interface): its current time is the scroll progress of a scroll container along an axis, as a percentage. It is a progress-based timeline whose duration is 100%.

public class ScrollTimeline : AnimationTimeline

Remarks

The timeline is sampled by the rendering steps of the event loop (https://drafts.csswg.org/scroll-animations-1/#event-loop): its current time is the one of the last rendering update, so it does not change while a script scrolls. A timeline created by the script API is sampled when it is created, with the current layout.

See also

Inheritance
AnimationTimeline ScrollTimeline

Constructors

NameDescription
ScrollTimeline(ScrollTimelineOptions?)Creates a scroll timeline (https://drafts.csswg.org/scroll-animations-1/#dom-scrolltimeline-scrolltimeline): its source is the source of the options, or the scrolling element of the document of the current global object. The timeline belongs to the document of its source (the document of the current global object without source).

ScrollTimeline(ScrollTimelineOptions?)

ScrollTimeline.cs

Creates a scroll timeline (https://drafts.csswg.org/scroll-animations-1/#dom-scrolltimeline-scrolltimeline): its source is the source of the options, or the scrolling element of the document of the current global object. The timeline belongs to the document of its source (the document of the current global object without source).

public ScrollTimeline(ScrollTimelineOptions? options = null)

Properties

NameDescription
AxisGets the axis of the timeline (https://drafts.csswg.org/scroll-animations-1/#dom-scrolltimeline-axis).
SourceGets the scroll container whose scroll position drives the timeline (https://drafts.csswg.org/scroll-animations-1/#dom-scrolltimeline-source). The source of a scroll(nearest) timeline is looked up from the current layout.

Gets the axis of the timeline (https://drafts.csswg.org/scroll-animations-1/#dom-scrolltimeline-axis).

public ScrollAxis Axis { get; }

Gets the scroll container whose scroll position drives the timeline (https://drafts.csswg.org/scroll-animations-1/#dom-scrolltimeline-source). The source of a scroll(nearest) timeline is looked up from the current layout.

public virtual Element? Source { get; }