Właściwość animacji styluFillMode
Przykład
Zmiana właściwości animationFillMode elementu <div>:
document.getElementById("myDIV").style.animationFillMode = "forwards";
Definicja i użycie
Właściwość animationFillMode określa, jakie style zostaną zastosowane do elementu, gdy animacja nie jest odtwarzana (kiedy jest zakończona lub gdy ma „opóźnienie”).
Domyślnie animacje CSS nie będą miały wpływu na animowany element, dopóki pierwsza klatka kluczowa nie zostanie „odtworzona”, a następnie przestaną wpływać na nią po zakończeniu ostatniej klatki kluczowej. Właściwość animationFillMode może zastąpić to zachowanie.
Obsługa przeglądarki
Liczby w tabeli określają pierwszą wersję przeglądarki, która w pełni obsługuje tę właściwość.
Liczby, po których następuje Moz, określają pierwszą wersję, która działała z przedrostkiem.
Property | |||||
---|---|---|---|---|---|
animationFillMode | 43.0 | 79.0 | 16.0 5.0 Moz |
9.0 | 30.0 |
Składnia
Zwróć właściwość animationFillMode:
object.style.animationFillMode
Ustaw właściwość animationFillMode:
object.style.animationFillMode = "none|forwards|backwards|both|initial|inherit"
Wartości nieruchomości
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 |
Szczegóły techniczne
Domyślna wartość: | Żaden |
---|---|
Wartość zwrotu: | String, reprezentujący właściwość animacji-fill-mode elementu |
Wersja CSS | CSS3 |
Powiązane strony
Odniesienie CSS: właściwość animacja-wypełnianie-mode