AnimationTimeline: duration property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The duration read-only property of the Web Animations API's AnimationTimeline interface returns the maximum value for this timeline or null.

Note that the derived interfaces ViewTimeline and ScrollTimeline always return a duration of 100%, while DocumentTimeline has no duration, and returns null.

Value

A number representing the timeline's duration (the maximum value for this timeline) or null.

Examples

View timeline duration

The ViewTimeline always returns a duration of 100% as a CSSUnitValue.

js
const subject = document.querySelector(".subject");
const timeline = new ViewTimeline({
  subject,
  axis: "block",
});

timeline.duration; // CSSUnitValue { value: 100, unit: "percent" }

Scroll timeline duration

The ScrollTimeline always returns a duration of 100% as a CSSUnitValue.

js
const timeline = new ScrollTimeline({
  source: document.documentElement,
  axis: "block",
});

timeline.duration; // CSSUnitValue { value: 100, unit: "percent" }

Document timeline duration

The DocumentTimeline has no duration.

js
document.timeline.duration; // null

Specifications

Specification
Web Animations Module Level 2
# dom-animationtimeline-duration

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
duration
Chrome – Full support
Chrome 115 (Release date: 2023-07-18)
footnote Full support
Edge – Full support
Edge 115 (Release date: 2023-07-21)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 101 (Release date: 2023-07-26)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 115 (Release date: 2023-07-21)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 77 (Release date: 2023-08-31)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – Full support
Samsung Internet 23 (Release date: 2023-10-18)
footnote Full support
WebView Android – Full support
WebView Android 115 (Release date: 2023-07-21)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

See also