double-dot.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view>
  3. <view
  4. class="spinner-inside"
  5. :style="{
  6. width: size + 40 + 'px',
  7. height: size + 40 + 'px'
  8. }"
  9. >
  10. <view :style="{ backgroundColor: color }" class="dot1"></view>
  11. <view :style="{ backgroundColor: color }" class="dot2"></view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'doubleDot',
  18. props: {
  19. color: String,
  20. size: Number
  21. }
  22. };
  23. </script>
  24. <style scoped>
  25. .spinner-inside {
  26. margin: 25px auto;
  27. position: relative;
  28. text-align: center;
  29. -webkit-animation: rotate 2s infinite linear;
  30. animation: rotate 2s infinite linear;
  31. }
  32. .dot1,
  33. .dot2 {
  34. width: 60%;
  35. height: 60%;
  36. display: inline-block;
  37. position: absolute;
  38. top: 0;
  39. background-color: #67cf22;
  40. border-radius: 100%;
  41. -webkit-animation: bounce 2s infinite ease-in-out;
  42. animation: bounce 2s infinite ease-in-out;
  43. }
  44. .dot2 {
  45. top: auto;
  46. bottom: 0px;
  47. -webkit-animation-delay: -1s;
  48. animation-delay: -1s;
  49. }
  50. @-webkit-keyframes rotate {
  51. 100% {
  52. -webkit-transform: rotate(360deg);
  53. }
  54. }
  55. @keyframes rotate {
  56. 100% {
  57. transform: rotate(360deg);
  58. -webkit-transform: rotate(360deg);
  59. }
  60. }
  61. @-webkit-keyframes bounce {
  62. 0%,
  63. 100% {
  64. -webkit-transform: scale(0);
  65. }
  66. 50% {
  67. -webkit-transform: scale(1);
  68. }
  69. }
  70. @keyframes bounce {
  71. 0%,
  72. 100% {
  73. transform: scale(0);
  74. -webkit-transform: scale(0);
  75. }
  76. 50% {
  77. transform: scale(1);
  78. -webkit-transform: scale(1);
  79. }
  80. }
  81. </style>