shrink-rect.vue 1.5 KB

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