16_animation.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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: run 5s ease 1s 2 forwards;
  14. /*
  15. 属性 描述
  16. @keyframes 规定动画模式。
  17. animation 设置所有动画属性的简写属性。
  18. animation-delay 规定动画开始的延迟。
  19. animation-direction 定动画是向前播放、向后播放还是交替播放。
  20. animation-duration 规定动画完成一个周期应花费的时间。
  21. animation-fill-mode 规定元素在不播放动画时的样式(在开始前、结束后,或两者同时)。
  22. animation-iteration-count 规定动画应播放的次数。
  23. animation-name 规定 @keyframes 动画的名称。
  24. animation-play-state 规定动画是运行还是暂停。
  25. animation-timing-function 规定动画的速度曲线。
  26. */
  27. }
  28. @keyframes run{
  29. 10%{
  30. width: 800px
  31. }
  32. 50%{
  33. width: 200px;
  34. }
  35. 100%{
  36. width: 400px;
  37. }
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <div id="div1"></div>
  43. </body>
  44. </html>