Animation()
constructor of the
Web 动画 API
returns a new
动画
对象实例。
var animation = new Animation([effect][, timeline]);
effect
可选
AnimationEffectReadOnly
interface, to assign to the animation. Although in the future other effects such as
SequenceEffect
s or
GroupEffect
s might be possible, the only kind of effect currently available is
KeyframeEffect
. This can be
null
(which is the default) to indicate that there should be no effect applied.
timeline
可选
timeline
with which to associate the animation, as an object of a type based on the
AnimationTimeline
interface. Currently the only timeline type available is
DocumentTimeline
, but in the future there my be timelines associated with gestures or scrolling, for example. The default value is
Document.timeline
, but this can be set to
null
还。
在
Follow the White Rabbit example
,
Animation()
constructor is used to create an
动画
为
rabbitDownKeyframes
using the document's
timeline
:
var rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline);
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 动画
The definition of 'Animation()' in that specification. |
工作草案 | 编者草案。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Animation()
构造函数
|
Chrome 61 | Edge ≤79 | Firefox 48 | IE 不支持 No | Opera 48 | Safari 不支持 No | WebView Android 61 | Chrome Android 61 | Firefox Android 48 | Opera Android 45 | Safari iOS 不支持 No | Samsung Internet Android 8.0 |
完整支持
不支持
实验。期望将来行为有所改变。
用户必须明确启用此特征。
动画
Animation()