Skip to content

Commit 22ad087

Browse files
authored
Merge pull request #792 from Shailsharma2604/master
Tri Color Loader
2 parents 513aa6c + 75a1189 commit 22ad087

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Please be aware that the demos may exhibit significant accessibility issues, suc
101101
- [Tooltips](#tooltips)
102102
- [Treeview](#treeview)
103103
- [Twitter Heart Animation](#twitter-heart-animation)
104+
- [Tri Color Loader](#Tri-Color-Loader)
104105
- [Book Animation](#book-animation)
105106
- [Zomato](#zomato)
106107
- [Zoom When Hover](#zoom-when-hover)
@@ -538,6 +539,15 @@ Please be aware that the demos may exhibit significant accessibility issues, suc
538539

539540
---
540541

542+
543+
## <a id="Tri_Color_Loader"></a>Tri Color Loader
544+
545+
[<img src="images/tri_color_loader.gif" height="230" title="Demo">](https://codepen.io/shail2604/pen/raxLgbo)
546+
547+
**[⬆ back to top](#quick-links)**
548+
549+
---
550+
541551
## <a id="BookAnimation"></a>Book Animation
542552

543553
[<img src="images/book_animation.gif" height="350" title="Book Animation">](https://codepen.io/Paras-Shenmare/pen/eYxJpQB)

Tri color loader/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="style.css">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<div class="circle" style="--index: 0;"></div>
11+
<div class="circle" style="--index: 1;"></div>
12+
<div class="circle" style="--index: 2;"></div>
13+
<div class="circle" style="--index: 3;"></div>
14+
<div class="circle" style="--index: 4;"></div>
15+
<div class="circle" style="--index: 5;"></div>
16+
<div class="circle" style="--index: 6;"></div>
17+
<div class="circle" style="--index: 7;"></div>
18+
<div class="circle" style="--index: 8;"></div>
19+
<div class="circle" style="--index: 9;"></div>
20+
<div class="circle" style="--index: 10;"></div>
21+
<div class="circle" style="--index: 11;"></div>
22+
<div class="circle" style="--index: 12;"></div>
23+
<div class="circle" style="--index: 13;"></div>
24+
<div class="circle" style="--index: 14;"></div>
25+
<div class="circle" style="--index: 15;"></div>
26+
</body>
27+
</html>

Tri color loader/style.css

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
}
6+
body {
7+
height: 100vh;
8+
display: grid;
9+
place-items: center;
10+
background: black;
11+
}
12+
.circle {
13+
--number: 16;
14+
--angle: calc(360deg / var(--number));
15+
--hue: 160;
16+
--thickness: 15px;
17+
--length: calc(var(--thickness) * 10);
18+
--distance: calc(var(--thickness) * -4);
19+
--duration: 2s;
20+
21+
grid-area: 1/1;
22+
width: var(--length);
23+
height: var(--thickness);
24+
border-radius: calc(var(--thickness) / 2);
25+
background: hsl(160, 100%, 51%);
26+
transform: rotate(calc(var(--index) * var(--angle)))
27+
translateY(var(--distance));
28+
animation: changeColor calc(var(--duration) * 1) linear infinite,
29+
changeOpacity var(--duration) linear infinite;
30+
animation-delay: calc((var(--duration) / var(--number)) * var(--index) * 0.1),
31+
calc((var(--duration) / var(--number)) * var(--index) * 0.5);
32+
mix-blend-mode: plus-lighter;
33+
}
34+
@keyframes changeColor {
35+
0%,
36+
100% {
37+
background: hsl(var(--hue), 100%, 51%);
38+
}
39+
50% {
40+
background: hsl(calc(var(--hue) + 180), 100%, 51%);
41+
}
42+
}
43+
@keyframes changeOpacity {
44+
0%,
45+
100% {
46+
opacity: 1;
47+
}
48+
/* NB : A small amount of opacity gives also good results */
49+
30%,
50+
80% {
51+
opacity: 0;
52+
}
53+
}

images/tri_color_loader.gif

805 KB
Loading

0 commit comments

Comments
 (0)