Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

คุณสมบัติ CSS แอนิเมชั่นเล่นสถานะ


ใช้ animation-play-state คุณสมบัติเพื่อกำหนดว่าแอนิเมชั่นกำลังทำงานหรือหยุดชั่วคราว

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งาน animation-play-state คุณสมบัติ:

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            width: 150px;
            height: 200px;
            position: relative;
            background: red;
            animation-name: myanim;
            animation-duration: 2s;
            animation-play-state: paused;
         }
         @keyframes myanim {
            from {left: 0px; background-color: green;}
            to {left: 100px; background-color: blue;}
         }
      </style>
   </head>
   <body>
      <div></div>
   </body>
</html>