#animation-play-state
Defines if an animation is playing or not.
默认属性
animation-play-state: running;
If the animation-duration
and animation-name
are defined, the animation will start playing automatically.
animation-play-state: paused;
The animation is set paused at the first keyframe.
This is different than having either no animation-duration
or animation-name
at all. If the animation is paused, the style applied is that of the first keyframe, and not the default style.
In this example, the square is visible by default, but the on the first keyframe of fadeAndMove
, the opacity
is set to 0
. When paused, the animation will be "stuck" on this first keyframe, and will thus be invisible.
@keyframes fadeAndMove { from { opacity: 0; transform: translateX(0); } to { opacity: 0; transform: translateX(100px); } }