Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Animation.Animation()

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

Animation构造函数返回一个新的Animation对象实例。

语法

var animation = new Animation(effect, timeline);

参数

effect 可选
KeyframeEffect对象分配给动画。(在将来,其他类型的效果,如SequenceEffects或GroupEffects是可能被实现的,但现在,唯一的效果是KeyframeEffect。)
timeline 可选
指定与动画关联的时间轴。 (目前唯一可用的时间轴类型是DocumentTimeline,但在将来我会有与手势或滚动相关联的时间轴。)默认为Document.timeline。 这也可以设置为null。

例子

White Rabbit示例中,Animation构造函数用于使用文档时间轴为兔子创建关键帧动画:

var rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline);

规范

Specification Status Comment
Web Animations
animation()
Working Draft Editor's draft.

浏览器支持

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 未实现 48 (48) [1] 未实现 未实现 未实现
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 未实现 48.0 (48) [1] 未实现 未实现 未实现

[1] Note that the KeyframeEffect and DocumentTimeline interfaces turned off in release channels, so this is not currently useful.

相关内容

文档标签和贡献者

 此页面的贡献者: Taoja
 最后编辑者: Taoja,