bounce.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view>
  3. <view class="spinner-inside" :style="{
  4. width: size + 110 + 'px',
  5. }">
  6. <view :style="{ backgroundColor:color }" class="bounce1"></view>
  7. <view :style="{ backgroundColor:color }" class="bounce2"></view>
  8. <view :style="{ backgroundColor:color }" class="bounce3"></view>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'bounce',
  15. props: {
  16. color: String,
  17. size: Number
  18. }
  19. }
  20. </script>
  21. <style scoped>
  22. .spinner-inside {
  23. margin: 25px auto;
  24. text-align: center;
  25. }
  26. .spinner-inside > view {
  27. width: 30px;
  28. height: 30px;
  29. border-radius: 100%;
  30. display: inline-block;
  31. -webkit-animation: bouncedelay 1.4s infinite ease-in-out;
  32. animation: bouncedelay 1.4s infinite ease-in-out;
  33. /* Prevent first frame from flickering when animation starts */
  34. -webkit-animation-fill-mode: both;
  35. animation-fill-mode: both;
  36. }
  37. .spinner-inside .bounce1 {
  38. -webkit-animation-delay: -0.32s;
  39. animation-delay: -0.32s;
  40. }
  41. .spinner-inside .bounce2 {
  42. -webkit-animation-delay: -0.16s;
  43. animation-delay: -0.16s;
  44. }
  45. @-webkit-keyframes bouncedelay {
  46. 0%, 80%, 100% { -webkit-transform: scale(0.0) }
  47. 40% { -webkit-transform: scale(1.0) }
  48. }
  49. @keyframes bouncedelay {
  50. 0%, 80%, 100% {
  51. transform: scale(0.0);
  52. -webkit-transform: scale(0.0);
  53. } 40% {
  54. transform: scale(1.0);
  55. -webkit-transform: scale(1.0);
  56. }
  57. }
  58. </style>