11_animation.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. #div1 {
  10. width: 200px;
  11. height: 200px;
  12. background: aqua;
  13. /* animation: name duration timing-function delay iteration-count direction fill-mode; */
  14. animation: run 5s ease 2s 2 forwards;
  15. /*
  16. animation 设置所有动画属性的简写属性。
  17. animation-delay 规定动画开始的延迟。
  18. animation-direction 定动画是向前播放、向后播放还是交替播放。
  19. animation-duration 规定动画完成一个周期应花费的时间。
  20. animation-fill-mode 规定元素在不播放动画时的样式(在开始前、结束后,或两者同时)。
  21. animation-iteration-count 规定动画应播放的次数。
  22. animation-name 规定 @keyframes 动画的名称。
  23. animation-play-state 规定动画是运行还是暂停。
  24. animation-timing-function 规定动画的速度曲线。
  25. */
  26. }
  27. @keyframes run {
  28. 10% {
  29. width: 800px
  30. }
  31. 50% {
  32. width: 150px;
  33. }
  34. 100% {
  35. width: 400px
  36. }
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <div id="div1"></div>
  42. </body>
  43. </html>