double-bounce.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view>
  3. <view
  4. class="spinner-inside"
  5. :style="{
  6. width: size + 20 + 'px',
  7. height: size + 20 + 'px'
  8. }"
  9. >
  10. <view :style="{ backgroundColor: color }" class="double-bounce1"></view>
  11. <view :style="{ backgroundColor: color }" class="double-bounce2"></view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'doubleBounce',
  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. }
  29. .double-bounce1,
  30. .double-bounce2 {
  31. width: 100%;
  32. height: 100%;
  33. border-radius: 50%;
  34. opacity: 0.6;
  35. position: absolute;
  36. top: 0;
  37. left: 0;
  38. -webkit-animation: bounce 2s infinite ease-in-out;
  39. animation: bounce 2s infinite ease-in-out;
  40. }
  41. .double-bounce2 {
  42. -webkit-animation-delay: -1s;
  43. animation-delay: -1s;
  44. }
  45. @-webkit-keyframes bounce {
  46. 0%,
  47. 100% {
  48. -webkit-transform: scale(0);
  49. }
  50. 50% {
  51. -webkit-transform: scale(1);
  52. }
  53. }
  54. @keyframes bounce {
  55. 0%,
  56. 100% {
  57. transform: scale(0);
  58. -webkit-transform: scale(0);
  59. }
  60. 50% {
  61. transform: scale(1);
  62. -webkit-transform: scale(1);
  63. }
  64. }
  65. </style>