• CSS3心跳和小球跳动animation案例


     

    1. <template>
    2. <div style="display: flex;">
    3. <div class="heart">
    4. div>
    5. <div class="info">
    6. <div class="ball">
    7. div>
    8. <div class="bottom">div>
    9. div>
    10. div>
    11. template>
    12. <style scoped lang="less">
    13. .info {
    14. display: flex;
    15. flex-direction: column;
    16. justify-content: center;
    17. align-items: center;
    18. width: 100vh;
    19. height: 100vh;
    20. }
    21. .heart {
    22. width: 100px;
    23. height: 100px;
    24. background-color: red;
    25. margin: 200px auto;
    26. transform: rotate(45deg) scale(.5);
    27. opacity: .5;
    28. // animation: hd 4s infinite;
    29. animation-name: hd;
    30. animation-duration: 2s;
    31. animation-iteration-count: infinite;
    32. &::before {
    33. content: '';
    34. position: absolute;
    35. width: 100px;
    36. height: 100px;
    37. border-radius: 50%;
    38. background-color: red;
    39. transform: translateX(-50px);
    40. }
    41. &::after {
    42. content: '';
    43. position: absolute;
    44. width: 100px;
    45. height: 100px;
    46. border-radius: 50%;
    47. background-color: red;
    48. transform: translateY(-50px);
    49. }
    50. }
    51. @keyframes hd {
    52. 25% {
    53. transform: rotate(45deg) scale(1);
    54. opacity: 1;
    55. }
    56. 50% {
    57. transform: rotate(45deg) scale(.5);
    58. opacity: .5;
    59. }
    60. 75% {
    61. transform: rotate(45deg) scale(1);
    62. opacity: 1;
    63. }
    64. 85% {
    65. transform: rotate(45deg) scale(.5);
    66. opacity: .5;
    67. }
    68. to {
    69. transform: rotate(45deg) scale(1);
    70. opacity: 1;
    71. }
    72. }
    73. .ball {
    74. width: 100px;
    75. height: 100px;
    76. // 渐变色
    77. background: radial-gradient(at center, #e67e22, #e74c3c); // 渐变色
    78. border-radius: 50%;
    79. border-radius: 50%;
    80. // margin: 300px 50px;
    81. animation: ball 1s infinite reverse;
    82. }
    83. .bottom {
    84. width: 300px;
    85. height: 40px;
    86. background-color: rgba(0, 0, 0, .3);
    87. border-radius: 50%;
    88. z-index: -1;
    89. filter: blur(5px);
    90. animation: shadow 1s infinite reverse;
    91. }
    92. @keyframes ball {
    93. to {
    94. transform: translateY(-200px);
    95. }
    96. }
    97. @keyframes shadow {
    98. to {
    99. width: 300px;
    100. height: 20px;
    101. background-color: rgba(0, 0, 0, .1);
    102. border-radius: 50%;
    103. filter: blur(35px);
    104. }
    105. }
    106. style>

  • 相关阅读:
    Canvas实现网页协同画板
    c#装饰器模式详解
    应用层 HTTP消息在服务端的路由 请求头 Host
    python CSSE7030
    【每日一题】689. 三个无重叠子数组的最大和-2023.11.19
    C++ 不知树系列之认识二叉树(顺序、链表存储的实现)
    设计模式——策略模式
    数据结构--栈
    Linux内核详解与内核优化方案
    一句话实现冒泡排序
  • 原文地址:https://blog.csdn.net/m0_62323730/article/details/138179452