Właściwość animacji CSS
Przykład
Powiązanie animacji z elementem <div> za pomocą właściwości shorthand:
div
{
animation: mymove 5s infinite;
}
Definicja i użycie
Właściwość animation
jest skróconą własnością dla:
- nazwa-animacji
- czas trwania animacji
- animacja-funkcja czasu
- Opóźnienie animacji
- liczba-iteracji-animacji
- kierunek animacji
- tryb wypełniania animacji
- animacja-stan-odtwarzania
Uwaga: Zawsze określaj właściwość animation-duration , w przeciwnym razie czas trwania wynosi 0 i nigdy nie zostanie odtworzony.
Domyślna wartość: | brak 0 luz 0 1 normalny brak bieganie |
---|---|
Dziedziczny: | nie |
Animowalny: | nie. Przeczytaj o animacji |
Wersja: | CSS3 |
Składnia JavaScript: | obiekt .style.animation="mymove 5s nieskończony" |
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 -webkit-, -moz- lub -o- określają pierwszą wersję, która działała z przedrostkiem.
Property | |||||
---|---|---|---|---|---|
animation | 43.0 4.0 -webkit- |
10.0 | 16.0 5.0 -moz- |
9.0 4.0 -webkit- |
30.0 15.0 -webkit- 12.0 -o- |
Składnia CSS
animation: name duration timing-function delay iteration-count
direction fill-mode play-state;
Wartości nieruchomości
Value | Description |
---|---|
animation-name | Specifies the name of the keyframe you want to bind to the selector |
animation-duration | Specifies how many seconds or milliseconds an animation takes to complete |
animation-timing-function | Specifies the speed curve of the animation |
animation-delay | Specifies a delay before the animation will start |
animation-iteration-count | Specifies how many times an animation should be played |
animation-direction | Specifies whether or not the animation should play in reverse on alternate cycles |
animation-fill-mode | Specifies what values are applied by the animation outside the time it is executing |
animation-play-state | Specifies whether the animation is running or paused |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Powiązane strony
Samouczek CSS: animacje CSS
Odniesienie HTML DOM: właściwość animacji