loop.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <view class="spinner-inside" :style="{
  4. width: size+'px',
  5. height: size+'px'
  6. }">
  7. <view class="spinner-inside-container container1">
  8. <view :style="{ backgroundColor:color }" class="circle1"></view>
  9. <view :style="{ backgroundColor:color }" class="circle2"></view>
  10. <view :style="{ backgroundColor:color }" class="circle3"></view>
  11. <view :style="{ backgroundColor:color }" class="circle4"></view>
  12. </view>
  13. <view class="spinner-inside-container container2">
  14. <view :style="{ backgroundColor:color }" class="circle1"></view>
  15. <view :style="{ backgroundColor:color }" class="circle2"></view>
  16. <view :style="{ backgroundColor:color }" class="circle3"></view>
  17. <view :style="{ backgroundColor:color }" class="circle4"></view>
  18. </view>
  19. <view class="spinner-inside-container container3">
  20. <view :style="{ backgroundColor:color }" class="circle1"></view>
  21. <view :style="{ backgroundColor:color }" class="circle2"></view>
  22. <view :style="{ backgroundColor:color }" class="circle3"></view>
  23. <view :style="{ backgroundColor:color }" class="circle4"></view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: 'loop',
  31. props: {
  32. color: String,
  33. size: Number
  34. }
  35. }
  36. </script>
  37. <style scoped>
  38. .spinner-inside {
  39. margin: 25px auto;
  40. position: relative;
  41. }
  42. .container1 > view, .container2 > view, .container3 > view {
  43. width: 12px;
  44. height: 12px;
  45. border-radius: 100%;
  46. position: absolute;
  47. -webkit-animation: bouncedelay 1.2s infinite ease-in-out;
  48. animation: bouncedelay 1.2s infinite ease-in-out;
  49. -webkit-animation-fill-mode: both;
  50. animation-fill-mode: both;
  51. }
  52. .spinner-inside .spinner-inside-container {
  53. position: absolute;
  54. width: 100%;
  55. height: 100%;
  56. }
  57. .container2 {
  58. -webkit-transform: rotateZ(45deg);
  59. transform: rotateZ(45deg);
  60. }
  61. .container3 {
  62. -webkit-transform: rotateZ(90deg);
  63. transform: rotateZ(90deg);
  64. }
  65. .circle1 { top: 0; left: 0; }
  66. .circle2 { top: 0; right: 0; }
  67. .circle3 { right: 0; bottom: 0; }
  68. .circle4 { left: 0; bottom: 0; }
  69. .container2 .circle1 {
  70. -webkit-animation-delay: -1.1s;
  71. animation-delay: -1.1s;
  72. }
  73. .container3 .circle1 {
  74. -webkit-animation-delay: -1.0s;
  75. animation-delay: -1.0s;
  76. }
  77. .container1 .circle2 {
  78. -webkit-animation-delay: -0.9s;
  79. animation-delay: -0.9s;
  80. }
  81. .container2 .circle2 {
  82. -webkit-animation-delay: -0.8s;
  83. animation-delay: -0.8s;
  84. }
  85. .container3 .circle2 {
  86. -webkit-animation-delay: -0.7s;
  87. animation-delay: -0.7s;
  88. }
  89. .container1 .circle3 {
  90. -webkit-animation-delay: -0.6s;
  91. animation-delay: -0.6s;
  92. }
  93. .container2 .circle3 {
  94. -webkit-animation-delay: -0.5s;
  95. animation-delay: -0.5s;
  96. }
  97. .container3 .circle3 {
  98. -webkit-animation-delay: -0.4s;
  99. animation-delay: -0.4s;
  100. }
  101. .container1 .circle4 {
  102. -webkit-animation-delay: -0.3s;
  103. animation-delay: -0.3s;
  104. }
  105. .container2 .circle4 {
  106. -webkit-animation-delay: -0.2s;
  107. animation-delay: -0.2s;
  108. }
  109. .container3 .circle4 {
  110. -webkit-animation-delay: -0.1s;
  111. animation-delay: -0.1s;
  112. }
  113. @-webkit-keyframes bouncedelay {
  114. 0%, 80%, 100% { -webkit-transform: scale(0.0) }
  115. 40% { -webkit-transform: scale(1.0) }
  116. }
  117. @keyframes bouncedelay {
  118. 0%, 80%, 100% {
  119. transform: scale(0.0);
  120. -webkit-transform: scale(0.0);
  121. } 40% {
  122. transform: scale(1.0);
  123. -webkit-transform: scale(1.0);
  124. }
  125. }
  126. </style>