33
Little Sun
A smiling sun whose rays turn steadily and who blinks once per turn. Pure CSS and SVG.
- Nature
- Cycle 3s
- Pure CSS and SVG, no JavaScript
- No dependencies
Customize
Palette
Preview background
Code
<!--
"Little Sun" loader by onemilliontools.com
https://loading.onemilliontools.com/loaders/sun
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
Keep this notice, or credit "onemilliontools.com" with a link, wherever you use it.
-->
<style>
.omt-sun {
/* change these four to restyle the loader */
--omt-c1: #2979FF;
--omt-c2: #FF9100;
--omt-speed: 1;
--omt-size: 96px;
width: var(--omt-size);
height: var(--omt-size);
display: block;
}
.omt-sun-body { fill: none; stroke: var(--omt-c1); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.omt-sun-rays path { fill: none; stroke: var(--omt-c2); stroke-width: 3; stroke-linecap: round; }
.omt-sun-eyes circle { fill: var(--omt-c1); }
.omt-sun-rays {
transform-box: view-box;
transform-origin: 48px 48px;
animation: omt-sun-spin calc(3s / var(--omt-speed)) linear infinite;
}
.omt-sun-eyes {
transform-box: fill-box;
transform-origin: 50% 50%;
animation: omt-sun-blink calc(3s / var(--omt-speed)) linear infinite;
}
@keyframes omt-sun-spin { to { transform: rotate(360deg); } }
@keyframes omt-sun-blink { 0%, 84%, 100% { transform: scaleY(1); } 92% { transform: scaleY(.1); } }
@media (prefers-reduced-motion: reduce) {
.omt-sun-rays, .omt-sun-eyes { animation: none; }
}
</style>
<svg class="omt-sun" style="--omt-c1:#2979FF;--omt-c2:#FF9100;--omt-speed:1;--omt-size:160px" viewBox="0 0 96 96" role="img" aria-label="Loading">
<g class="omt-sun-rays">
<path d="M48 18V25" transform="rotate(0 48 48)"/>
<path d="M48 18V25" transform="rotate(45 48 48)"/>
<path d="M48 18V25" transform="rotate(90 48 48)"/>
<path d="M48 18V25" transform="rotate(135 48 48)"/>
<path d="M48 18V25" transform="rotate(180 48 48)"/>
<path d="M48 18V25" transform="rotate(225 48 48)"/>
<path d="M48 18V25" transform="rotate(270 48 48)"/>
<path d="M48 18V25" transform="rotate(315 48 48)"/>
</g>
<circle class="omt-sun-body" cx="48" cy="48" r="15"/>
<g class="omt-sun-eyes"><circle cx="43" cy="46" r="2.2"/><circle cx="53" cy="46" r="2.2"/></g>
<path class="omt-sun-body" style="stroke-width:2.4" d="M43 53q5 5 10 0"/>
</svg>
52 lines
The math
Eight rays, 45° apart, rotating linearly 360° in 3 s; the blink is a scaleY dip at 92 % of the cycle.
Attribution
Free for personal and commercial use under CC BY 4.0. Keep the comment at the top of the snippet, or credit the author with a visible link.
Loader animation by onemilliontools.com: <a href="https://loading.onemilliontools.com/loaders/sun">onemilliontools.com</a>