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

คุณสมบัติ CSS ภาพเคลื่อนไหว-ระยะเวลา


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

ตัวอย่าง

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งาน animation-duration ทรัพย์สิน −

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