Thuộc tính hoạt hình kiểu
Thí dụ
Thay đổi hoạt ảnh của phần tử <div>, sử dụng thuộc tính tốc ký:
document.getElementById("myDIV").style.animation = "mynewmove 4s 2";
Định nghĩa và Cách sử dụng
Thuộc tính hoạt ảnh là một thuộc tính viết tắt cho sáu trong số các thuộc tính hoạt ảnh:
hoạt
hình Tên hoạt
hình Hoạt hình
bão hòa Hoạt hình định hướng Hoạt hình chức năng
Hoạt hình chậm hơn Hoạt động theo số lượng Hoạt
hình định hướng
Lưu ý: Luôn chỉ định thuộc tính animationDuration, nếu không thời lượng bằng 0 và sẽ không bao giờ được phát.
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.1 12.0 O |
Cú pháp
Trả lại thuộc tính hoạt ảnh:
object.style.animation
Đặt thuộc tính hoạt ảnh:
object.style.animation = "name duration timingFunction delay iterationCount direction fillMode playState"
Giá trị tài sản
Value | Description |
---|---|
animationName | Specifies the name of the keyframe you want to bind to the selector |
animationDuration | Specifies how many seconds or milliseconds an animation takes to complete |
animationTimingFunction | Specifies the speed curve of the animation |
animationDelay | Specifies a delay before the animation will start |
animationIterationCount | Specifies how many times an animation should be played |
animationDirection | Specifies whether or not the animation should play in reverse on alternate cycles |
animationFillMode | Specifies what values are applied by the animation outside the time it is executing |
animationPlayState | 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 |
Chi tiết kỹ thuật
Giá trị mặc định: | không 0 dễ dàng 0 1 bình thường không chạy |
---|---|
Giá trị trả lại: | Một chuỗi, đại diện cho thuộc tính hoạt ảnh của một phần tử |
Phiên bản CSS | CSS3 |
Các trang liên quan
Tham chiếu CSS: thuộc tính hoạt ảnh