当前位置:   article > 正文

HTML和CSS实现简易动画效果(循环播放)_html循环animation

html循环animation

 

 

  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>动画-左上右下</title>
  8. <style>
  9. body{
  10. background-color: #08ECD9;
  11. }
  12. .whole{
  13. width: 600px;
  14. height: 600px;
  15. margin: 0 auto;
  16. border: 1px solid #1E1E1E;
  17. }
  18. .xiao{
  19. width: 100px;
  20. height: 100px;
  21. background-color: #E06D6D;
  22. border-radius: 100%;
  23. transform: translate(500%,500%);
  24. animation: left-top-right-bottom 5s linear infinite;
  25. }
  26. @keyframes left-top-right-bottom{
  27. 25%{
  28. transform: translate(0%,500%);
  29. border-radius: 0%;
  30. background-color: #A6C244;
  31. }
  32. 50%{
  33. transform: translate(0%,0%);
  34. border-radius: 0%;
  35. background-color: #95DA3A;
  36. }
  37. 75%{
  38. transform: translate(500%,0%);
  39. border-radius: 50%;
  40. background-color: #C8905C;
  41. }
  42. 100%{
  43. transform: translate(500%,500%);
  44. border-radius: 100%;
  45. background-color: #95DA3A;
  46. }
  47. }
  48. </style>
  49. </head>
  50. <body>
  51. <div class="whole">
  52. <div class="xiao"></div>
  53. </div>
  54. </body>
  55. </html>

效果: 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/803877
推荐阅读
相关标签