Vlastnost stylu animaceFillMode
Příklad
Změna vlastnosti animationFillMode prvku <div>:
document.getElementById("myDIV").style.animationFillMode = "forwards";
Definice a použití
Vlastnost animationFillMode určuje, jaké styly se použijí pro prvek, když se animace nepřehrává (když je dokončena nebo když má "zpoždění").
Ve výchozím nastavení neovlivní animace CSS prvek, který animujete, dokud není „přehrán první klíčový snímek“, a poté jej přestanou ovlivňovat po dokončení posledního klíčového snímku. Vlastnost animationFillMode může toto chování přepsat.
Podpora prohlížeče
Čísla v tabulce určují první verzi prohlížeče, která plně podporuje vlastnost.
Čísla následovaná Mozem určují první verzi, která pracovala s předponou.
Property | |||||
---|---|---|---|---|---|
animationFillMode | 43.0 | 79.0 | 16.0 5.0 Moz |
9.0 | 30.0 |
Syntax
Vraťte vlastnost animationFillMode:
object.style.animationFillMode
Nastavte vlastnost animationFillMode:
object.style.animationFillMode = "none|forwards|backwards|both|initial|inherit"
Hodnoty vlastností
Value | Description |
---|---|
none | Default value. The animation will not apply any styles to the target before or after it is executing |
forwards | After the animation ends (determined by animation-iteration-count), the animation will apply the property values for the time the animation ended |
backwards | The animation will apply the property values defined in the keyframe that will start the first iteration of the animation, during the period defined by animation-delay. These are either the values of the from keyframe (when animation-direction is "normal" or "alternate") or those of the to keyframe (when animationDirection is "reverse" or "alternate-reverse") |
both | The animation will follow the rules for both forwards and backwards. That is, it will extend the animation properties in both directions |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technické údaje
Výchozí hodnota: | žádný |
---|---|
Návratová hodnota: | Řetězec představující vlastnost animace-výplň-mód prvku |
Verze CSS | CSS3 |
Související stránky
CSS reference: vlastnost animation-fill-mode