Properti arah animasi CSS
Contoh
Mainkan animasi ke depan terlebih dahulu, lalu mundur:
div {
animation-direction: alternate;
}
Lebih banyak contoh "Coba Sendiri" di bawah ini.
Definisi dan Penggunaan
Properti animation-direction
menentukan apakah animasi harus diputar maju, mundur, atau dalam siklus alternatif.
Nilai bawaan: | normal |
---|---|
Diwarisi: | tidak |
Animasi: | tidak. Baca tentang animasi |
Versi: kapan: | CSS3 |
Sintaks JavaScript: | objek .style.animationDirection="terbalik" |
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung properti.
Angka yang diikuti oleh -webkit-, -moz-, atau -o- menentukan versi pertama yang berfungsi dengan awalan.
Property | |||||
---|---|---|---|---|---|
animation-direction | 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- |
Sintaks CSS
animation-direction: normal|reverse|alternate|alternate-reverse|initial|inherit;
Nilai properti
Value | Description | Play it |
---|---|---|
normal | Default value. The animation is played as normal (forwards) | |
reverse | The animation is played in reverse direction (backwards) | |
alternate | The animation is played forwards first, then backwards | |
alternate-reverse | The animation is played backwards first, then forwards | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Lebih Banyak Contoh
Contoh
Mainkan animasi mundur terlebih dahulu, lalu maju:
div {
animation-direction: alternate-reverse;
}
Contoh
Putar animasi mundur:
div {
animation-direction: reverse;
}
Halaman Terkait
Tutorial CSS: Animasi CSS
Referensi HTML DOM: properti animationDirection