double-bounce.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <view>
  3. <view class="spinner-inside" :style="{
  4. width: size+20+'px',
  5. height: size+20+'px'
  6. }">
  7. <view :style="{ backgroundColor:color }" class="double-bounce1"></view>
  8. <view :style="{ backgroundColor:color }" class="double-bounce2"></view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'doubleBounce',
  15. props: {
  16. color: String,
  17. size: Number
  18. }
  19. }
  20. </script>
  21. <style scoped>
  22. .spinner-inside {
  23. margin: 25px auto;
  24. position: relative;
  25. }
  26. .double-bounce1, .double-bounce2 {
  27. width: 100%;
  28. height: 100%;
  29. border-radius: 50%;
  30. opacity: 0.6;
  31. position: absolute;
  32. top: 0;
  33. left: 0;
  34. -webkit-animation: bounce 2.0s infinite ease-in-out;
  35. animation: bounce 2.0s infinite ease-in-out;
  36. }
  37. .double-bounce2 {
  38. -webkit-animation-delay: -1.0s;
  39. animation-delay: -1.0s;
  40. }
  41. @-webkit-keyframes bounce {
  42. 0%, 100% { -webkit-transform: scale(0.0) }
  43. 50% { -webkit-transform: scale(1.0) }
  44. }
  45. @keyframes bounce {
  46. 0%, 100% {
  47. transform: scale(0.0);
  48. -webkit-transform: scale(0.0);
  49. } 50% {
  50. transform: scale(1.0);
  51. -webkit-transform: scale(1.0);
  52. }
  53. }
  54. </style>