此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

Animation:timeline 属性

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年7月.

Animation 接口的 Animation.timeline 属性返回或设置与此动画关联的时间线。时间线是基于 AnimationTimeline,用于同步的时间值源的对象。默认情况下,动画的时间线和 Document 的时间线是相同的。

一个用作动画的时间源的时间线对象;或者表示使用默认时间线(即 Document 的时间线)的 null 值。

示例

以下代码将动画的时间线设置为与文档的时间线相同(另外,这是所有动画的默认时间线):

js
animation.timeline = document.timeline;

规范

Specification
Web Animations
# dom-animation-timeline

浏览器兼容性

参见