Thuộc tính hoạt ảnh CSS
Ví dụ
Liên kết hoạt ảnh với phần tử <div>, sử dụng thuộc tính tốc ký:
div
{
animation: mymove 5s infinite;
}
Hãy tự mình thử »Định nghĩa và cách sử dụng
Thuộc tính animation
là thuộc tính viết tắt của:
- tên hoạt hình
- Thời lượng hoạt ảnh
- chức năng hoạt hình-thời gian
- độ trễ hoạt hình
- hoạt hình-lặp-đếm
- hướng hoạt hình
- chế độ điền hoạt ảnh
- hoạt hình-chơi-trạng thái
Lưu ý: Luôn chỉ định thuộc tính animation-duration , nếu không thời lượng bằng 0 và sẽ không bao giờ được phát.
Giá trị mặc định: | không 0 dễ dàng 0 1 bình thường không chạy |
---|---|
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: | object .style.animation="mymove 5s vô hạn" Hãy dùng thử |
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 | 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: name duration timing-function delay iteration-count
direction fill-mode play-state ;
Giá trị tài sản
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 |
Trang liên quan
Hướng dẫn CSS: Hoạt hình CSS
Tham chiếu DOM HTML: thuộc tính hoạt ảnh