ls-loading.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="grid-loader">
  3. <view class="cube"></view>
  4. <view class="cube"></view>
  5. <view class="cube"></view>
  6. <view class="cube"></view>
  7. <view class="cube"></view>
  8. <view class="cube"></view>
  9. <view class="cube"></view>
  10. <view class="cube"></view>
  11. <view class="cube"></view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'ls-loading',
  17. data() {
  18. return {};
  19. },
  20. methods: {}
  21. };
  22. </script>
  23. <style lang="scss" scoped>
  24. /* From Uiverse.io by PriyanshuGupta28 */
  25. .grid-loader {
  26. display: grid;
  27. grid-template-columns: repeat(3, 1fr);
  28. gap: 8rpx;
  29. transform: rotate(45deg);
  30. opacity: 0;
  31. animation: fadeIn 0.5s ease-out forwards;
  32. margin-right: 20rpx;
  33. }
  34. @keyframes fadeIn {
  35. to {
  36. opacity: 1;
  37. }
  38. }
  39. .cube {
  40. width: 12rpx;
  41. height: 12rpx;
  42. background: #333;
  43. animation: cubeScale 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  44. /* 新增颜色动画 */
  45. box-shadow: 0 0 15px rgba(205, 152, 61, 0.3);
  46. transform: scale(0);
  47. opacity: 0;
  48. }
  49. @keyframes cubeScale {
  50. 0% {
  51. transform: scale(0);
  52. opacity: 0;
  53. background: #333;
  54. /* 起始黑色 */
  55. }
  56. 50% {
  57. transform: scale(1);
  58. opacity: 1;
  59. background: #FFD700;
  60. /* 放大时变为金色 */
  61. }
  62. 100% {
  63. transform: scale(0);
  64. opacity: 0;
  65. background: #333;
  66. /* 缩回黑色 */
  67. }
  68. }
  69. /* Staggered animation delays */
  70. .cube:nth-child(1) {
  71. animation-delay: 0.2s;
  72. }
  73. .cube:nth-child(2) {
  74. animation-delay: 0.4s;
  75. }
  76. .cube:nth-child(3) {
  77. animation-delay: 0.6s;
  78. }
  79. .cube:nth-child(4) {
  80. animation-delay: 0.8s;
  81. }
  82. .cube:nth-child(5) {
  83. animation-delay: 1s;
  84. }
  85. .cube:nth-child(6) {
  86. animation-delay: 1.2s;
  87. }
  88. .cube:nth-child(7) {
  89. animation-delay: 1.4s;
  90. }
  91. .cube:nth-child(8) {
  92. animation-delay: 1.6s;
  93. }
  94. .cube:nth-child(9) {
  95. animation-delay: 1.8s;
  96. }
  97. </style>