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

ตั้งค่าโค้งความเร็วต่างๆ ด้วย CSS transition-timing-function

ใช้คุณสมบัติ transition-timing-function เพื่อกำหนดโค้งความเร็วของ transition effect ค่าที่ใช้ได้ ได้แก่ ease, ease-in, ease-out, linear เป็นต้น

ตัวอย่าง

<!DOCTYPE html> <html>    <head>       <style>          div {             width: 100px;             height: 100px;             background: red;             transition: width 4s;          }          #effect1 {             transition-timing-function: linear;          }          #effect2 {             transition-timing-function: ease-in;          }          #effect3 {             transition-timing-function: ease-out;          }          div:hover {             width: 250px;          }       </style>    </head>    <body>       <h1>Transition Effect</h1>       <p>Hover over the div elements and see the transition effect and the speed:</p>       <div id = "effect1">linear effect</div><br>       <div id = "effect2">ease-in effect</div><br>       <div id = "effect3">ease-out effect</div><br>    </body> </html>