-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathprogress-bar.common.scss
More file actions
249 lines (187 loc) · 5.26 KB
/
progress-bar.common.scss
File metadata and controls
249 lines (187 loc) · 5.26 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
@import "../../themes/mixins";
// Progress bar
// ------------------------------------------------------------------------
// Host has no background by default - this will be added to the progress-buffer-bar
:host {
display: block;
position: relative;
width: 100%;
contain: strict;
direction: ltr;
overflow: hidden;
}
.progress,
.progress-indeterminate,
.indeterminate-bar-primary,
.indeterminate-bar-secondary,
.progress-buffer-bar {
@include position(0, 0, 0, 0);
position: absolute;
width: 100%;
height: 100%;
}
.buffer-circles-container,
.buffer-circles {
@include position(0, 0, 0, 0);
position: absolute;
}
// Extend a bit to overflow. The size of animated distance.
.buffer-circles {
/* stylelint-disable property-disallowed-list */
right: -10px;
left: -10px;
/* stylelint-enable property-disallowed-list */
}
// Determinate progress bar
// --------------------------------------------------
.progress,
.progress-buffer-bar,
.buffer-circles-container {
/* stylelint-disable-next-line property-disallowed-list */
transform-origin: left top;
transition: transform 150ms linear;
}
// Progress and background bar
// --------------------------------------------------
.progress,
.progress-indeterminate {
background: var(--progress-background);
z-index: 2;
}
.progress-buffer-bar {
background: var(--background);
z-index: 1;
}
.buffer-circles-container {
overflow: hidden;
}
// MD based animation on indeterminate type
// --------------------------------------------------
.indeterminate-bar-primary {
/* stylelint-disable property-disallowed-list */
top: 0;
right: 0;
bottom: 0;
left: -145.166611%;
/* stylelint-enable property-disallowed-list */
animation: primary-indeterminate-translate 2s infinite linear;
.progress-indeterminate {
animation: primary-indeterminate-scale 2s infinite linear;
animation-play-state: inherit;
}
}
.indeterminate-bar-secondary {
/* stylelint-disable property-disallowed-list */
top: 0;
right: 0;
bottom: 0;
left: -54.888891%;
/* stylelint-enable property-disallowed-list */
animation: secondary-indeterminate-translate 2s infinite linear;
.progress-indeterminate {
animation: secondary-indeterminate-scale 2s infinite linear;
animation-play-state: inherit;
}
}
// Progress Bar: Buffer Circles
// ------------------------------------------------------------------------
.buffer-circles {
background-image: radial-gradient(ellipse at center, var(--background) 0%, var(--background) 30%, transparent 30%);
/* stylelint-disable property-disallowed-list */
background-repeat: repeat-x;
background-position: 5px center;
background-size: 10px 10px;
/* stylelint-enable property-disallowed-list */
z-index: 0;
animation: buffering 450ms infinite linear;
}
// Progress Bar: Reversed
// ------------------------------------------------------------------------
// If reversed is set to true, the animation will be reversed
// and the bar will start at the top right
:host(.progress-bar-reversed) {
transform: scaleX(-1);
}
// Progress Bar: Paused
// ------------------------------------------------------------------------
:host(.progress-paused) {
.indeterminate-bar-secondary,
.indeterminate-bar-primary,
.buffer-circles {
animation-play-state: paused;
}
}
// Progress Bar: Animation Keyframes
// ------------------------------------------------------------------------
// Source: https://github.com/material-components/material-components-web/blob/master/packages/mdc-linear-progress/_keyframes.scss
@keyframes primary-indeterminate-translate {
0% {
transform: translateX(0);
}
20% {
animation-timing-function: cubic-bezier(0.5, 0, 0.701732, 0.495819);
transform: translateX(0);
}
59.15% {
animation-timing-function: cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);
transform: translateX(83.67142%);
}
100% {
transform: translateX(200.611057%);
}
}
@keyframes primary-indeterminate-scale {
0% {
transform: scaleX(0.08);
}
36.65% {
animation-timing-function: cubic-bezier(0.334731, 0.12482, 0.785844, 1);
transform: scaleX(0.08);
}
69.15% {
animation-timing-function: cubic-bezier(0.06, 0.11, 0.6, 1);
transform: scaleX(0.661479);
}
100% {
transform: scaleX(0.08);
}
}
@keyframes secondary-indeterminate-translate {
0% {
animation-timing-function: cubic-bezier(0.15, 0, 0.515058, 0.409685);
transform: translateX(0);
}
25% {
animation-timing-function: cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);
transform: translateX(37.651913%);
}
48.35% {
animation-timing-function: cubic-bezier(0.4, 0.627035, 0.6, 0.902026);
transform: translateX(84.386165%);
}
100% {
transform: translateX(160.277782%);
}
}
@keyframes secondary-indeterminate-scale {
0% {
animation-timing-function: cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);
transform: scaleX(0.08);
}
19.15% {
animation-timing-function: cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);
transform: scaleX(0.457104);
}
44.15% {
animation-timing-function: cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);
transform: scaleX(0.72796);
}
100% {
transform: scaleX(0.08);
}
}
@keyframes buffering {
to {
transform: translateX(-10px);
}
}