zoukankan      html  css  js  c++  java
  • css3 动画

    1、过渡
        所有的过渡必须明确指定改变数值,height,width等必须是精确地数值或百分比,不能为auto;
        只要能明确改变属性数值的事件都可以触发过渡,class,JavaScript,hover等;
    1. .height-animate {
    2. -webkit-transition: -webkit-transform .3s ease-in-out, height .3s ease-in-out;
    3. -moz-transition: -moz-transform .3s ease-in-out, height .3s ease-in-out;
    4. -o-transition: -o-transform .3s ease-in-out, height .3s ease-in-out;
    5. transition: transform .3s ease-in-out, height .3s ease-in-out
    6. }
    7. .all-animate {
    8. transition: all .5s;
    9. transition-property: all;
    10. transition-duration: .5s;
    11. transition-timing-function: initial;
    12. transition-delay: initial;
    13. }
    2、动画
    1. @keyframes anm {
    2. 0% {
    3. width: 10px;
    4. height: 10px;
    5. }
    6. 50% {
    7. width: 200px;
    8. }
    9. 100% {
    10. width: 200px;
    11. height: 100px;
    12. }
    13. }
    14. .demo {
    15. display: inline-block;
    16. background: green;
    17. }
    18. .demo:hover {
    19. -webkit-animation-name: anm;
    20. -moz-animation-name: anm;
    21. -o-animation-name: anm;
    22. animation-name: anm;
    23. animation-timing-function: ease-in-out;
    24. animation-duration: 2s;
    25. animation-fill-mode: forwards; /*动画结束时停留在最后一帧*/
    26. }
    3、变形
    1. <!DOCTYPE html>
    2. <html>
    3. <head lang="en">
    4. <meta charset="UTF-8">
    5. <title></title>
    6. <style>
    7. .demo img {
    8. transition: all 0.3s ease-in-out;
    9. }
    10. .demo img:hover {
    11. transform: translate(100px) scale(1.5);
    12. }
    13. @keyframes anm {
    14. 0% {
    15. transform: rotate(0deg)
    16. }
    17. 50% {
    18. transform: rotate(90deg)
    19. }
    20. 100% {
    21. transform: rotate(180deg)
    22. }
    23. }
    24. .demo2 img:hover {
    25. -webkit-animation-name: anm;
    26. -moz-animation-name: anm;
    27. -o-animation-name: anm;
    28. animation-name: anm;
    29. animation-timing-function: ease-in-out;
    30. animation-duration: 2s;
    31. animation-fill-mode: forwards; /*动画结束时停留在最后一帧*/
    32. }
    33. </style>
    34. </head>
    35. <body>
    36. <div class="demo"><img src="img/question_mark.png">aaaaaa</div>
    37. <br>
    38. <div class="demo2"><img src="img/question_mark.png">aaaaaa</div>
    39. </body>
    40. </html>






    附件列表

    • 相关阅读:
      LeetCode Subsets II
      LeetCode Rotate Image
      LeetCode Palidrome Number
      LeetCode Generate Parentheses
      LeetCode Maximum Subarray
      LeetCode Set Matrix Zeroes
      LeetCode Remove Nth Node From End of List
      Linux Loop设备 使用
      Linux 文件系统大小调整
      LeetCode N-Queens II
    • 原文地址:https://www.cnblogs.com/vvch/p/4871641.html
    Copyright © 2011-2022 走看看