Thuộc tính hoạt ảnh CSS
Thí 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;
}
Định nghĩa và Cách sử dụng
Thuộc animation
tính này là một thuộc tính viết tắt cho:
- tên hoạt hình
- Thời lượng hoạt ảnh
- hoạt hình-thời gian-chức năng
- hoạt cảnh chậm trễ
- hoạt-động-lặp-đếm
- hướng hoạt hình
- hoạt ảnh-điền-chế độ
- hoạt hình-phát-trạng thái
Lưu ý: Luôn chỉ định thuộc tính thời lượng hoạt ảnh , 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ỗ 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 -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 |
Các trang liên quan
Hướng dẫn CSS: CSS Animations
Tham chiếu DOM HTML: thuộc tính hoạt ảnh