02Orb Pulse Whose Breathing Widens With a Growing Wait-time Value
A wait-time value drives a sine-eased scale and blur on a central orb so it breathes in and out, and the longer the value accumulates the wider that breathing amplitude gets.
Best forAI answer-generation wait overlays, sidebar assistant icons
BREATH_HZAMP_BASEAMP_GROW

<main class="stage">
<div class="ld" id="ld">
<p class="ld__hint">
<svg class="ld__ico" viewBox="0 0 256 256" aria-hidden="true"><g fill="currentColor"><path d="M232 56v56a8 8 0 0 1-16 0V91.3l-25.6 25.7A80 80 0 1 1 174 60a8 8 0 1 1-9 13.2A64 64 0 1 0 179.7 128H216a8 8 0 0 1 0 16h-56a8 8 0 0 1-8-8V80a8 8 0 0 1 16 0v20.7L192.7 76A80.1 80.1 0 0 0 64 128a8 8 0 0 1-16 0a96 96 0 0 1 163.6-68.3L224 71.3V56a8 8 0 0 1 8 8" opacity=".2"/><path d="M224 48a8 8 0 0 0-8 8v15.3l-11.7-11.6a96 96 0 1 0 27.6 51.6a8 8 0 0 0-15.8 2.5a80 80 0 1 1-23-43l-25.7 25.7A8 8 0 0 0 173 112h56a8 8 0 0 0 8-8V56a8 8 0 0 0-13-8"/></g></svg>
<span>Click or press the space bar to pause or restart</span>
</p>
<div class="ld__field" id="field" role="application" aria-label="Orb breathing-pulse test panel" tabindex="0">
<div class="ld__orb" id="orb"></div>
<b class="ld__badge" aria-hidden="true"><span class="ld__badgeNum" id="pct">0%</span><span class="ld__badgeUnit">Waiting</span></b>
</div>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// orb-morph-pulse — 대기 시간 값을 사인 이징에 넣어 중심 오브 크기·블러를 숨쉬듯 반복시키고,
// 대기 시간 값이 쌓일수록(accum) 숨쉬는 폭(amp) 자체가 조금씩 커진다. @keyframes 없음 — rAF 전용.
$duration: $dur-loop;
$easing: $ease-spring;
$color: $subject-ink;
@include stage($stage-yellow);
.ld {
display: flex; flex-direction: column; gap: $sp-2;
width: 100%; max-width: 424px;
}
.ld__hint {
display: flex; align-items: center; gap: $sp-1; margin: 0;
font-weight: 700; font-size: clamp(10px, 2.8vw, 12px); line-height: 1.35;
color: $subject-ink;
}
.ld__ico { width: 16px; height: 16px; flex: 0 0 auto; color: $subject-blue-deep; }
.ld__field {
position: relative; height: 208px;
display: flex; align-items: center; justify-content: center;
border-radius: $r-card; overflow: hidden;
background: rgba($subject-ink, .06);
box-shadow: inset 0 0 0 1px rgba($subject-ink, .16);
cursor: pointer;
}
.ld__field:focus-visible { outline: 2px solid $subject-blue-deep; outline-offset: 2px; }
.ld__orb {
--scale: 1; --blur: 12px; --glow: .35;
width: 108px; height: 108px; border-radius: $r-pill;
background: radial-gradient(circle at 38% 34%, $subject-blue-light, $subject-blue-deep 70%);
transform: scale(var(--scale));
filter: blur(calc(var(--blur) * .18));
box-shadow: 0 0 42px calc(var(--glow) * 60px) rgba($subject-blue-deep, var(--glow));
}
.ld__badge {
position: absolute; right: $sp-2; top: $sp-2;
display: flex; align-items: baseline; gap: $sp-1;
padding: $sp-1 $sp-2; border-radius: $r-pill;
background: rgba($subject-ink, .82);
color: $subject-cream; font-weight: 700; font-size: 11px;
}
.ld__badgeNum { font-size: 13px; color: $stage-yellow; }
.ld__badgeUnit { font-weight: 700; }
@media (max-width: 340px) {
.ld { gap: $sp-1; }
.ld__field { height: 124px; }
.ld__orb { width: 64px; height: 64px; }
.ld__badge { font-size: 10px; padding: 0 $sp-1; }
.ld__badgeNum { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
.ld.is-still .ld__field { cursor: default !important; }
.ld.is-still .ld__badge { opacity: .92 !important; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #ffd23f;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.ld {
display: flex;
flex-direction: column;
gap: 8px;
width: 100%;
max-width: 424px;
}
.ld__hint {
display: flex;
align-items: center;
gap: 4px;
margin: 0;
font-weight: 700;
font-size: clamp(10px, 2.8vw, 12px);
line-height: 1.35;
color: #17141a;
}
.ld__ico {
width: 16px;
height: 16px;
flex: 0 0 auto;
color: #0a4fe8;
}
.ld__field {
position: relative;
height: 208px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 16px;
overflow: hidden;
background: rgba(23, 20, 26, 0.06);
box-shadow: inset 0 0 0 1px rgba(23, 20, 26, 0.16);
cursor: pointer;
}
.ld__field:focus-visible {
outline: 2px solid #0a4fe8;
outline-offset: 2px;
}
.ld__orb {
--scale: 1;
--blur: 12px;
--glow: .35;
width: 108px;
height: 108px;
border-radius: 999px;
background: radial-gradient(circle at 38% 34%, #5b8cf8, #0a4fe8 70%);
transform: scale(var(--scale));
filter: blur(calc(var(--blur) * 0.18));
box-shadow: 0 0 42px calc(var(--glow) * 60px) rgba(10, 79, 232, var(--glow));
}
.ld__badge {
position: absolute;
right: 8px;
top: 8px;
display: flex;
align-items: baseline;
gap: 4px;
padding: 4px 8px;
border-radius: 999px;
background: rgba(23, 20, 26, 0.82);
color: #fff7e6;
font-weight: 700;
font-size: 11px;
}
.ld__badgeNum {
font-size: 13px;
color: #ffd23f;
}
.ld__badgeUnit {
font-weight: 700;
}
@media (max-width: 340px) {
.ld {
gap: 4px;
}
.ld__field {
height: 124px;
}
.ld__orb {
width: 64px;
height: 64px;
}
.ld__badge {
font-size: 10px;
padding: 0 4px;
}
.ld__badgeNum {
font-size: 11px;
}
}
@media (prefers-reduced-motion: reduce) {
.ld.is-still .ld__field {
cursor: default !important;
}
.ld.is-still .ld__badge {
opacity: 0.92 !important;
}
}(function () {
var LOOP = 2.0;
var BREATH_HZ = 0.9; // 숨쉬기 사인 진동수
var AMP_BASE = 0.10; // 숨쉬는 폭 시작 값
var AMP_GROW = 0.09; // Waiting 시간 값이 쌓이며 늘어나는 폭
var root = document.getElementById('ld');
var field = document.getElementById('field');
var orb = document.getElementById('orb');
var pctEl = document.getElementById('pct');
var paused = false;
var t0 = performance.now();
var raf = 0;
function reduced() {
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
}
function easeSine(t) { return 0.5 - 0.5 * Math.cos(t * Math.PI); }
function draw(sec) {
var t = sec % LOOP;
var accum = Math.min(sec, LOOP) / LOOP; // Waiting 시간 값이 쌓인 정도(0~1)
var amp = AMP_BASE + AMP_GROW * easeSine(accum);
var wave = Math.sin(t * Math.PI * 2 * BREATH_HZ);
var scale = 1 + amp * wave;
var blur = 12 + 9 * Math.max(0, wave);
var glow = 0.35 + 0.25 * Math.max(0, wave);
orb.style.setProperty('--scale', scale.toFixed(4));
orb.style.setProperty('--blur', blur.toFixed(1) + 'px');
orb.style.setProperty('--glow', glow.toFixed(3));
var pct = Math.round((t / LOOP) * 100);
pctEl.textContent = pct + '%';
}
function togglePause() {
paused = !paused;
root.classList.toggle('is-paused', paused);
}
function restart() { t0 = performance.now(); draw(0); }
function onKey(e) {
if (e.key === ' ' || e.key === 'Enter') { e.preventDefault(); togglePause(); }
else if (e.key === 'r' || e.key === 'R') { e.preventDefault(); restart(); }
}
field.addEventListener('click', togglePause);
field.addEventListener('keydown', onKey);
function onResize() {
if (paused || reduced()) draw((performance.now() - t0) / 1000);
}
window.addEventListener('resize', onResize);
function frame(now) {
if (!paused) draw((now - t0) / 1000);
raf = requestAnimationFrame(frame);
}
if (reduced()) {
root.classList.add('is-still');
draw(LOOP * 0.62);
} else {
raf = requestAnimationFrame(frame);
}
})();// OrbPulse — vanilla 판(run/403/demo/02-ai-processing-loading-orb-morph-pulse/index.html) 의 React 포트.
// 대기 시간 값을 사인 이징에 넣어 오브 크기·블러를 숨쉬듯 반복시키고, 대기 시간이 쌓일수록 폭이 커진다.
import { useEffect, useRef } from "react";
import type { CSSProperties } from "react";
import styles from "./OrbPulse.module.scss";
export type OrbPulseProps = {
duration?: string;
easing?: string;
color?: string;
};
type Vars = CSSProperties & { "--duration"?: string; "--easing"?: string; "--color"?: string };
type Box<T> = { current: T };
type KeyEvt = { key: string; preventDefault(): void };
const LOOP = 2.0;
const BREATH_HZ = 0.9;
const AMP_BASE = 0.10;
const AMP_GROW = 0.09;
const FIELD_LABEL = "오브 숨쉬기 펄스 실험판";
function easeSine(t: number): number { return 0.5 - 0.5 * Math.cos(t * Math.PI); }
export default function OrbPulse({
duration = "2s",
easing = "cubic-bezier(.2, .8, .2, 1)",
color = "#17141a",
}: OrbPulseProps) {
const rootRef = useRef<HTMLDivElement | null>(null);
const fieldRef = useRef<HTMLDivElement | null>(null);
const orbRef = useRef<HTMLDivElement | null>(null);
const pctRef = useRef<HTMLSpanElement | null>(null);
const pausedRef = useRef(false) as Box<boolean>;
const t0Ref = useRef(0) as Box<number>;
const rafRef = useRef(0) as Box<number>;
const vars: Vars = { "--duration": duration, "--easing": easing, "--color": color };
function reduced(): boolean {
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}
function draw(sec: number): void {
const orb = orbRef.current;
const pctEl = pctRef.current;
if (!orb) return;
const t = sec % LOOP;
const accum = Math.min(sec, LOOP) / LOOP;
const amp = AMP_BASE + AMP_GROW * easeSine(accum);
const wave = Math.sin(t * Math.PI * 2 * BREATH_HZ);
const scale = 1 + amp * wave;
const blur = 12 + 9 * Math.max(0, wave);
const glow = 0.35 + 0.25 * Math.max(0, wave);
orb.style.setProperty("--scale", scale.toFixed(4));
orb.style.setProperty("--blur", blur.toFixed(1) + "px");
orb.style.setProperty("--glow", glow.toFixed(3));
if (pctEl) pctEl.textContent = Math.round((t / LOOP) * 100) + "%";
}
function togglePause(): void {
pausedRef.current = !pausedRef.current;
const root = rootRef.current;
if (root) root.classList.toggle("is-paused", pausedRef.current);
}
function restart(): void { t0Ref.current = performance.now(); draw(0); }
function onKey(e: KeyEvt): void {
if (e.key === " " || e.key === "Enter") { e.preventDefault(); togglePause(); }
else if (e.key === "r" || e.key === "R") { e.preventDefault(); restart(); }
}
function onClick(): void { togglePause(); }
function onResize(): void {
if (pausedRef.current || reduced()) draw((performance.now() - t0Ref.current) / 1000);
}
function frame(now: number): void {
if (!pausedRef.current) draw((now - t0Ref.current) / 1000);
rafRef.current = requestAnimationFrame(frame);
}
useEffect(() => {
const root = rootRef.current;
if (!root) return;
t0Ref.current = performance.now();
window.addEventListener("resize", onResize);
if (reduced()) {
root.classList.add("is-still");
draw(LOOP * 0.62);
} else {
rafRef.current = requestAnimationFrame(frame);
}
return () => {
window.removeEventListener("resize", onResize);
cancelAnimationFrame(rafRef.current);
};
}, []);
return (
<main className={styles.stage}>
<div className={styles.root} ref={rootRef} style={vars}>
<p className={styles.hint}>
<svg className={styles.ico} viewBox="0 0 256 256" aria-hidden="true"><g fill="currentColor"><path d="M232 56v56a8 8 0 0 1-16 0V91.3l-25.6 25.7A80 80 0 1 1 174 60a8 8 0 1 1-9 13.2A64 64 0 1 0 179.7 128H216a8 8 0 0 1 0 16h-56a8 8 0 0 1-8-8V80a8 8 0 0 1 16 0v20.7L192.7 76A80.1 80.1 0 0 0 64 128a8 8 0 0 1-16 0a96 96 0 0 1 163.6-68.3L224 71.3V56a8 8 0 0 1 8 8" opacity=".2"/><path d="M224 48a8 8 0 0 0-8 8v15.3l-11.7-11.6a96 96 0 1 0 27.6 51.6a8 8 0 0 0-15.8 2.5a80 80 0 1 1-23-43l-25.7 25.7A8 8 0 0 0 173 112h56a8 8 0 0 0 8-8V56a8 8 0 0 0-13-8"/></g></svg>
<span>클릭하거나 스페이스바를 누르면 멈추거나 다시 갑니다</span>
</p>
<div
className={styles.field}
ref={fieldRef}
role="application"
aria-label={FIELD_LABEL}
tabIndex={0}
onClick={onClick}
onKeyDown={onKey}
>
<div className={styles.orb} ref={orbRef}></div>
<b className={styles.badge} aria-hidden="true"><span className={styles.badgeNum} ref={pctRef}>0%</span><span className={styles.badgeUnit}>대기</span></b>
</div>
</div>
</main>
);
}02 Orb Pulse Whose Breathing Widens With a Growing Wait-time Value — Measured area 30.089% · moving frames 23/23Original by GODRICH · SCSS and React ship in the zip · AI Loading Animation: 9 Patterns by One Value
The post this demo lives in
AI Loading Animation: 9 Patterns by One ValueOne ai loading animation value: A high orbit-radius value scatters particles wide; near zero they snap onto the core, hu See all demos in this post
If you like this effect - similar demos
Loaders03 QR Code Whose Pulse Ring Narrows by the Time Left ValueQR Code Loading Animation — 9 CSS Expiry Patterns
Loaders05 Icon progress ring — an indicator whose circular progress value fills with the pulled distance and morphs into a checkmark once completePull to Refresh CSS: 9 Loading Patterns
Loaders09 Loader Whose Inner Ring Widens Its Precession Angle With the ValueCSS 3D Cube Animation Loaders, 9 Patterns