English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
CSS3 animation-play-The state property specifies whether to play the animation or pause it.
The following table summarizes the usage context and version history of this property.
Default value: | running |
---|---|
Applies to: | All elements ::before and ::after Pseudo-element |
Inheritance: | None |
Animation can be made: | No.请参见 Please see. |
Animation attributes | CSS3Version: |
New feature of | object object.style.animationPlayState="paused" |
The syntax of this attribute is as follows:
animation-play-state: paused | running | initial | inherit
The following example demonstrates how to use the animation-play-state attribute.
.box { width: 50px; height: 50px; background: red; position: relative; /* Chrome, Safari, Opera */ -webkit-animation-name: moveit; -webkit-animation-duration: 2s; -webkit-animation-play-state: paused; animation-name: moveit; animation-duration: 2s; animation-play-state: paused; } /* Chrome, Safari, Opera */ @-webkit-keyframes moveit { from {left: 0;} to {left: 50%;} } @keyframes moveit { from {left: 0;} to {left: 50%;} }Test and see‹/›
The following table describes the value of this attribute.
Value | Description |
---|---|
paused | Specify that the animation is currently paused. |
running | Specify that the animation is currently running. This is the default value. |
initial | Set this property to its default value. |
inherit | If specified, the associated element adopts its parent element's animation-play-The calculated value of the state attribute. |
Note:The animation can be-play-The state attribute can be used in combination with JavaScript to pause the animation at the middle of the loop.
animation-play-Browser compatibility of the state attribute, all mainstream browsers support this attribute.
|
Please refer to the following tutorial:CSS3Animation.
Related attributes and rules:animation-name,animation-duration,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,animation-fill-mode,animation-play-state,@keyframes.