Thuộc tính hướng hoạt hình CSS
Ví dụ
Phát hoạt ảnh tiến lên trước, sau đó phát ngược lại:
div {
animation-direction: alternate;
}
Hãy tự mình thử »Thêm ví dụ "Hãy tự mình thử" bên dưới.
Định nghĩa và cách sử dụng
Thuộc tính animation-direction
xác định liệu một hoạt ảnh sẽ được phát tiến, lùi hay theo chu kỳ luân phiên.
Giá trị mặc định: | Bình thường |
---|---|
Thừa hưởng: | KHÔNG |
Hoạt hình: | KHÔNG. Đọc về hoạt hình |
Phiên bản: | CSS3 |
Cú pháp JavaScript: | đối tượng .style.animationDirection="reverse"Hãy thử nó |
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.
Các số theo sau là -webkit-, -moz- hoặc -o- chỉ định phiên bản đầu tiên hoạt động với tiền tố.
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- |
Cú pháp CSS
animation-direction: normal|reverse|alternate|alternate-reverse|initial|inherit;
Giá trị tài sản
Value | Description | Demo |
---|---|---|
normal | Default value. The animation is played as normal (forwards) | Play it » |
reverse | The animation is played in reverse direction (backwards) | Play it » |
alternate | The animation is played forwards first, then backwards | Play it » |
alternate-reverse | The animation is played backwards first, then forwards | Play it » |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Thêm ví dụ
Ví dụ
Phát hoạt ảnh lùi lại trước, sau đó phát tiếp:
div {
animation-direction: alternate-reverse;
}
Hãy tự mình thử »Trang liên quan
Hướng dẫn CSS: Hoạt hình CSS
Tham chiếu DOM HTML: thuộc tính animationDirection