8.transition.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. #box {
  9. width: 200px;
  10. height: 200px;
  11. background: red;
  12. transition: all 2s ease-in 5s;
  13. }
  14. #box:hover {
  15. width: 500px;
  16. height: 500px;
  17. background: yellow;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <!--
  23. 动画
  24. 过渡效果:在一定时间内平滑的过渡
  25. transition:
  26. transition-property: 执行名称(all/width/height)
  27. transition-duration: 执行过渡效果时间
  28. transition-timing-function:运动曲线
  29. linear 规定以相同速度开始至结束的过渡效果(等于 cubic-bezier(0,0,1,1))。
  30. ease 规定慢速开始,然后变快,然后慢速结束的过渡效果(cubic-bezier(0.25,0.1,0.25,1))。
  31. ease-in 规定以慢速开始的过渡效果(等于 cubic-bezier(0.42,0,1,1))。
  32. ease-out 规定以慢速结束的过渡效果(等于 cubic-bezier(0,0,0.58,1))。
  33. ease-in-out 规定以慢速开始和结束的过渡效果(等于 cubic-bezier(0.42,0,0.58,1))。
  34. transition-delay 过渡效果何时开始。
  35. -->
  36. <div id="box"></div>
  37. </body>
  38. </html>