加载动画

Loading 加载 2026/05/31 15:37

HTML代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<div class="container">
  <div class="liquid-loader">
    <div class="loading-text">
      Loading
      <span class="dot">.</span>
      <span class="dot">.</span>
      <span class="dot">.</span>
    </div>

    <div class="loader-track">
      <div class="liquid-fill"></div>
    </div>
  </div>
</div>

CSS代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
.container {
  width: 100%;
  height: 320px;
  background: #1e1e1e;
  padding-top: 100px;
}

.liquid-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 20px;
  font-family: system-ui, sans-serif;
}

.loader-track {
  position: relative;
  width: 180px;
  height: 32px;
  background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.6),
    0 1px 3px rgba(255, 255, 255, 0.1);
}

.liquid-fill {
  position: absolute;
  top: 2px;
  left: 2px;
  height: calc(100% - 4px);
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #ec4899, #f59e0b);
  border-radius: 14px;
  animation:
    fillProgress 4s ease-out infinite,
    colorShift 3s linear infinite;
  box-shadow:
    0 0 12px rgba(124, 58, 237, 0.4),
    inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.loading-text {
  color: white;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  animation: textGlow 1s ease-in-out infinite;
}

.dot {
  margin-left: 3px;
  animation: blink 1.5s infinite;
}
.dot:nth-of-type(1) {
  animation-delay: 0s;
}
.dot:nth-of-type(2) {
  animation-delay: 0.3s;
}
.dot:nth-of-type(3) {
  animation-delay: 0.6s;
}

@keyframes fillProgress {
  0% {
    width: 4px;
  }
  25% {
    width: 25%;
  }
  50% {
    width: 50%;
  }
  75% {
    width: 75%;
  }
  100% {
    width: calc(100% - 4px);
  }
}

@keyframes colorShift {
  0% {
    filter: hue-rotate(0deg) brightness(1);
  }
  33% {
    filter: hue-rotate(120deg) brightness(1.1);
  }
  66% {
    filter: hue-rotate(240deg) brightness(0.9);
  }
  100% {
    filter: hue-rotate(360deg) brightness(1);
  }
}

@keyframes textGlow {
  0%,
  100% {
    opacity: 0.7;
    text-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 16px rgba(139, 92, 246, 0.6);
  }
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}