Latest web development tutorials

HTML DOM Style animation properties

Style Object Reference Style Objects

Examples

Use shorthand property change <div> element of animation:

document.getElementById("myDIV").style.animation="mymove 5s infinite";

try it"

Definition and Usage

animation property is a shorthand property animation six attributes:

animationName
animationDuration
animationTimingFunction
animationDelay
animationIterationCount
animationDirection.

Note: Always provisions animationDuration property, otherwise duration to zero, will not play the animation.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Firefox and Opera support animation attributes.

Safari and Chrome support another alternative of the property attribute that WebkitAnimation property.

Note: Internet Explorer 9 and earlier versions do not support animation attributes.


grammar

Returns animation attributes:

object .style.animation

Setting animation properties:

object .style.animation="name duration timingFunction delay iterationCount direction fillMode playState"

Property Value

描述
animationName 指定要绑定到选择器的关键帧的名称。
animationDuration 规定动画完成需花费的秒数或毫秒数。
animationTimingFunction 指定动画的速度曲线。
animationDelay 规定动画开始的延迟时间。
animationIterationCount 规定动画的播放次数。
animationDirection 规定是否循环交替反向播放动画。
animationFillMode 规定当动画不播放时(当动画完成时,或当动画有一个延迟未开始播放时),要应用到元素的样式。
animationPlayState 规定动画是运行的还是暂停的。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: none 0 ease 0 1 normal none running
return value: String representing the animation element attributes.
CSS version CSS3


related articles

CSS Reference Manual: Animation Properties


Style Object Reference Style Objects