สไตล์แอนิเมชั่นคุณสมบัติ
ตัวอย่าง
การเปลี่ยนภาพเคลื่อนไหวขององค์ประกอบ <div> โดยใช้คุณสมบัติชวเลข:
document.getElementById("myDIV").style.animation = "mynewmove 4s 2";
ความหมายและการใช้งาน
คุณสมบัติแอนิเมชั่นเป็นคุณสมบัติชวเลขสำหรับคุณสมบัติแอนิเมชั่นหกรายการ:
แอ
นิเมชั่ น แอนิเม
ชั่ นชื่อ ภาพเคลื่อนไหวระยะ
เวลา
หมายเหตุ:ระบุคุณสมบัติ animationDuration เสมอ มิฉะนั้น ระยะเวลาจะเป็น 0 และจะไม่มีวันเล่น
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนคุณสมบัติอย่างสมบูรณ์
Numbers ตามด้วย Webkit, Moz หรือ O ระบุเวอร์ชันแรกที่ใช้งานได้กับคำนำหน้า
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 |
ไวยากรณ์
ส่งคืนคุณสมบัติแอนิเมชั่น:
object.style.animation
ตั้งค่าคุณสมบัติแอนิเมชั่น:
object.style.animation = "name duration timingFunction delay iterationCount direction fillMode playState"
มูลค่าทรัพย์สิน
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 |
รายละเอียดทางเทคนิค
ค่าเริ่มต้น: | ไม่มี 0 สบาย 0 1 ปกติ ไม่มีวิ่ง |
---|---|
คืนมูลค่า: | สตริงที่แสดงถึงคุณสมบัติแอนิเมชั่นขององค์ประกอบ |
เวอร์ชัน CSS | CSS3 |
หน้าที่เกี่ยวข้อง
การอ้างอิง CSS: คุณสมบัติแอนิเมชั่น