6_动画.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: 100px;
  10. height: 100px;
  11. background-color: red;
  12. animation-name: foo;
  13. animation-duration: 1s;
  14. animation-timing-function: linear;
  15. /* animation-iteration-count: 2; */
  16. animation-fill-mode: forwards;
  17. }
  18. @keyframes foo {
  19. 0%{
  20. width: 100px;
  21. height: 100px;
  22. }
  23. 50%{
  24. width: 300px;
  25. }
  26. 100%{
  27. width: 300px;
  28. height: 300px;
  29. }
  30. }
  31. /* .div1{
  32. width: 0;
  33. height: 0;
  34. margin:100px auto;
  35. border-top: 50px solid red;
  36. border-left: 50px solid blue;
  37. border-right: 50px solid yellow;
  38. border-bottom: 50px solid green;
  39. animation-name: foo;
  40. animation-duration: 1s;
  41. animation-timing-function: linear;
  42. animation-iteration-count: infinite;
  43. animation-delay: 2s;
  44. } */
  45. /* @keyframes foo {
  46. from{
  47. transform: rotate(0);
  48. }
  49. to{
  50. transform: rotate(360deg);
  51. }
  52. } */
  53. .div1:hover{
  54. animation-play-state: paused;
  55. }
  56. </style>
  57. </head>
  58. <body>
  59. <div class="box"></div>
  60. <!-- <div class="div1"></div> -->
  61. </body>
  62. </html>