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