CSS3动画 -- 笔记 - 图2review0514 animation

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>animation</title>
  6. <style type="text/css">
  7. body{
  8. background-color: #abcdef;
  9. }
  10. section{
  11. position: relative;
  12. width: 760px;
  13. height: 760px;
  14. margin: auto;
  15. transform-style: preserve-3d;
  16. }
  17. div{
  18. position: absolute;
  19. top: 0;
  20. right: 0;
  21. bottom: 0;
  22. left: 0;
  23. width: 100%;
  24. height: 100%;
  25. margin: auto;
  26. background-repeat: no-repeat;
  27. background-position: center;
  28. }
  29. .inner{
  30. background-image: url(images/circle_inner.png);
  31. animation-name: circle_inner;
  32. animation-duration: 2s;
  33. animation-delay: 1s;
  34. animation-iteration-count: infinite;
  35. animation-direction: alternate;
  36. animation-fill-mode: both;
  37. animation-play-state: running;
  38. }
  39. .middle{
  40. background-image: url(images/circle_middle.png);
  41. animation-name: circle_middle;
  42. animation-duration: 2s;
  43. animation-delay: 1s;
  44. animation-iteration-count: infinite;
  45. animation-direction: alternate;
  46. animation-fill-mode: both;
  47. animation-play-state: running;
  48. }
  49. .outer{
  50. background-image: url(images/circle_outer.png);
  51. animation-name: circle_outer;
  52. animation-duration: 2s;
  53. animation-delay: 1s;
  54. animation-iteration-count: infinite;
  55. animation-direction: alternate;
  56. animation-fill-mode: both;
  57. animation-play-state: running;
  58. }
  59. .dodoke{
  60. background-image: url(images/dodoke.png);
  61. }
  62. @keyframes circle_inner{
  63. from {
  64. transform: rotateX(0deg);
  65. }
  66. to {
  67. transform: rotateX(360deg);
  68. }
  69. }
  70. @keyframes circle_middle{
  71. from {
  72. transform: rotateY(0deg);
  73. }
  74. to {
  75. transform: rotateY(360deg);
  76. }
  77. }
  78. @keyframes circle_outer{
  79. from {
  80. transform: rotateZ(0deg);
  81. }
  82. to {
  83. transform: rotateZ(360deg);
  84. }
  85. }
  86. </style>
  87. </head>
  88. <body>
  89. <section>
  90. <div class="inner"></div>
  91. <div class="middle"></div>
  92. <div class="outer"></div>
  93. <div class="dodoke"></div>
  94. </section>
  95. </body>
  96. </html>

review0514 animation2

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>animation2</title>
    <style type="text/css">
        div{
            width: 100px;
            height: 100px;
            position: relative;
            animation: changecolor 5s .5s infinite alternate;
        }

        @keyframes changecolor{
            0%{
                background-color: red;
                left: 0px; 
                top: 0px;
            }
            25%{
                background-color: yellow;
                left: 200px; 
                top: 0px;
            }
            50%{
                background-color: blue;
                left: 200px; 
                top: 200px;
            }
            75%{
                background-color: green;
                left: 0px; 
                top: 200px;
            }
            100%{
                background-color: red;
                left: 0px; 
                top: 0px;
            }
        }
    </style>
</head>
<body>
    <div></div>
</body>
</html>