Skip to content

Commit 54efb4e

Browse files
authored
Merge pull request #605 from Shailsharma2604/master
New_Loader has been added
2 parents 174e154 + 0496939 commit 54efb4e

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ Please be aware that the demos may exhibit significant accessibility issues, suc
648648

649649
[<img src="images/loader.gif" height="230" title="loader">](https://github.com/you-dont-need/You-Dont-Need-JavaScript/assets/97428742/97ba01f5-7e85-4c3e-8d60-47374ef3a1f9)
650650

651+
[<img src="images/New_Loader.png" height="230" title="New_Loader">](https://codepen.io/shail-sharma/pen/yLmMyjq)
652+
651653
**[⬆ back to top](#quick-links)**
652654

653655
---

images/New_Loader.png

23.7 KB
Loading

new_Loader/index.html

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
<title>New_Loader</title>
7+
<link rel="stylesheet" href="styles.css">
8+
</head>
9+
<body>
10+
<main>
11+
<svg class="ip" viewBox="0 0 256 128" width="256px" height="128px" xmlns="http://www.w3.org/2000/svg">
12+
<defs>
13+
<linearGradient id="grad1" x1="0" y1="0" x2="1" y2="0">
14+
<stop offset="0%" stop-color="#5ebd3e" />
15+
<stop offset="33%" stop-color="#ffb900" />
16+
<stop offset="67%" stop-color="#f78200" />
17+
<stop offset="100%" stop-color="#e23838" />
18+
</linearGradient>
19+
<linearGradient id="grad2" x1="1" y1="0" x2="0" y2="0">
20+
<stop offset="0%" stop-color="#e23838" />
21+
<stop offset="33%" stop-color="#973999" />
22+
<stop offset="67%" stop-color="#009cdf" />
23+
<stop offset="100%" stop-color="#5ebd3e" />
24+
</linearGradient>
25+
</defs>
26+
<g fill="none" stroke-linecap="round" stroke-width="16">
27+
<g class="ip__track" stroke="#ddd">
28+
<path d="M8,64s0-56,60-56,60,112,120,112,60-56,60-56"/>
29+
<path d="M248,64s0-56-60-56-60,112-120,112S8,64,8,64"/>
30+
</g>
31+
<g stroke-dasharray="180 656">
32+
<path class="ip__worm1" stroke="url(#grad1)" stroke-dashoffset="0" d="M8,64s0-56,60-56,60,112,120,112,60-56,60-56"/>
33+
<path class="ip__worm2" stroke="url(#grad2)" stroke-dashoffset="358" d="M248,64s0-56-60-56-60,112-120,112S8,64,8,64"/>
34+
</g>
35+
</g>
36+
</svg>
37+
</main>
38+
</body>
39+
</html>

new_Loader/style.css

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
* {
2+
border: 0;
3+
box-sizing: border-box;
4+
margin: 0;
5+
padding: 0;
6+
}
7+
:root {
8+
--hue: 223;
9+
--bg: hsl(var(--hue),90%,95%);
10+
--fg: hsl(var(--hue),90%,5%);
11+
--trans-dur: 0.3s;
12+
font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320));
13+
}
14+
body {
15+
background-color: var(--bg);
16+
color: var(--fg);
17+
font: 1em/1.5 sans-serif;
18+
height: 100vh;
19+
display: grid;
20+
place-items: center;
21+
transition: background-color var(--trans-dur);
22+
}
23+
main {
24+
padding: 1.5em 0;
25+
}
26+
.ip {
27+
width: 16em;
28+
height: 8em;
29+
}
30+
.ip__track {
31+
stroke: hsl(var(--hue),90%,90%);
32+
transition: stroke var(--trans-dur);
33+
}
34+
.ip__worm1,
35+
.ip__worm2 {
36+
animation: worm1 2s linear infinite;
37+
}
38+
.ip__worm2 {
39+
animation-name: worm2;
40+
}
41+
42+
/* Dark theme */
43+
@media (prefers-color-scheme: dark) {
44+
:root {
45+
--bg: hsl(var(--hue),90%,5%);
46+
--fg: hsl(var(--hue),90%,95%);
47+
}
48+
.ip__track {
49+
stroke: hsl(var(--hue),90%,15%);
50+
}
51+
}
52+
53+
/* Animation */
54+
@keyframes worm1 {
55+
from {
56+
stroke-dashoffset: 0;
57+
}
58+
50% {
59+
animation-timing-function: steps(1);
60+
stroke-dashoffset: -358;
61+
}
62+
50.01% {
63+
animation-timing-function: linear;
64+
stroke-dashoffset: 358;
65+
}
66+
to {
67+
stroke-dashoffset: 0;
68+
}
69+
}
70+
@keyframes worm2 {
71+
from {
72+
stroke-dashoffset: 358;
73+
}
74+
50% {
75+
stroke-dashoffset: 0;
76+
}
77+
to {
78+
stroke-dashoffset: -358;
79+
}
80+
}

0 commit comments

Comments
 (0)