loop.vue 3.2 KB

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