33
小太阳
光芒匀速旋转的小太阳,每转一圈眨一次眼。纯 CSS + SVG。
- 自然
- 周期 3s
- 纯 CSS + SVG,无 JavaScript
- 无依赖
自定义
配色
预览背景
代码
<!--
"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 行
背后的数学
8 条射线相隔 45°,3 秒线性旋转 360°;眨眼是在周期 92% 处的一次 scaleY 压扁。
署名
按 CC BY 4.0 免费用于个人与商业项目。请保留代码开头的注释,或用一个可见链接署名作者。
Loader animation by onemilliontools.com: <a href="https://loading.onemilliontools.com/loaders/sun">onemilliontools.com</a>