-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay8_AnimatedProgressBar.css
101 lines (90 loc) · 2.07 KB
/
Day8_AnimatedProgressBar.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
/*
HTML:
<!doctype html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="container">
<div class="progress-bar">
<div class="progress-status"></div>
</div>
</div>
</body>
</html>
CSS:
*/
html, body {
margin: 0;
padding: 0;
}
:root {
--progressbar-bg: lightgrey;
--start: red;
--middle: blue;
--finish: green;
}
.container {
position: relative;
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
align-items: center;
background: #CAF4F4;
}
/* outer progress bar */
.progress-bar {
position: relative;
width: 400px;
height: 40px;
background: var(--progressbar-bg);
border-radius: 30px;
box-shadow: rgba(100, 60, 0, 0.55) 0px 4px 4px;
overflow: hidden;
z-index: 1;
}
/* inner progress bar */
.progress-status {
position: absolute;
width: 100%; /* set to 100% to fill the outer progress bar */
height: 100%;
border-radius: 30px;
z-index: 2;
/* background: linear-gradient(to left, var(--start), var(--middle), var(--finish)); */
/* animation: name duration timing-function delay iteration-count direction fill-mode play-state;
*/
/* animation: barAnimation 5s linear 3s infinite; --> delay works only at the start 1x ands stops delaying because it's infinite */
animation: barAnimation 5s linear infinite;
background: linear-gradient(to left, var(--start), var(--middle), var(--finish));
/* background-size: 300% 100%; */
}
@keyframes barAnimation {
0% {
width: 0%;
background: var(--start);
}
25% {
width: 25%;
background: var(--start);
}
45% {
width: 45%;
background: var(--middle);
}
65% {
width: 65%;
background: var(--middle);
}
85% {
width: 100%;
background: var(--finish);
/* transition, creates pause effect */
}
100% {
width: 100%;
background: var(--finish);
}
}