shrink-rect.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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="rect1"></view>
  8. <view :style="{ backgroundColor:color }" class="rect2"></view>
  9. <view :style="{ backgroundColor:color }" class="rect3"></view>
  10. <view :style="{ backgroundColor:color }" class="rect4"></view>
  11. <view :style="{ backgroundColor:color }" class="rect5"></view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'shrinkRect',
  18. props: {
  19. color: String,
  20. size: Number
  21. },
  22. }
  23. </script>
  24. <style scoped>
  25. .spinner-inside {
  26. margin: 25px auto;
  27. text-align: center;
  28. font-size: 10px;
  29. }
  30. .spinner-inside > view {
  31. height: 100%;
  32. width: 12%;
  33. margin: 0 2px;
  34. display: inline-block;
  35. -webkit-animation: stretchdelay 1.2s infinite ease-in-out;
  36. animation: stretchdelay 1.2s infinite ease-in-out;
  37. }
  38. .spinner-inside .rect2 {
  39. -webkit-animation-delay: -1.1s;
  40. animation-delay: -1.1s;
  41. }
  42. .spinner-inside .rect3 {
  43. -webkit-animation-delay: -1.0s;
  44. animation-delay: -1.0s;
  45. }
  46. .spinner-inside .rect4 {
  47. -webkit-animation-delay: -0.9s;
  48. animation-delay: -0.9s;
  49. }
  50. .spinner-inside .rect5 {
  51. -webkit-animation-delay: -0.8s;
  52. animation-delay: -0.8s;
  53. }
  54. @-webkit-keyframes stretchdelay {
  55. 0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
  56. 20% { -webkit-transform: scaleY(1.0) }
  57. }
  58. @keyframes stretchdelay {
  59. 0%, 40%, 100% {
  60. transform: scaleY(0.4);
  61. -webkit-transform: scaleY(0.4);
  62. } 20% {
  63. transform: scaleY(1.0);
  64. -webkit-transform: scaleY(1.0);
  65. }
  66. }
  67. </style>