05Loader Whose Sphere-Surface Points Converge to a Single Point
Points spread evenly across a sphere's surface are moved toward the center by a ratio tied to the progress value, converging into a single overlapping point once the value is full.
Best forData-sync completion indicators, app-initialization screens
GOLDEN_ANGLESPHERE_Rtransform-style

<main class="stage">
<div class="ld" id="ld">
<p class="ld__hint">Click or press the space bar to pause or restart</p>
<div class="ld__field" id="field" role="application" aria-label="Sphere point-convergence test panel" tabindex="0">
<div class="c3__scene">
<div class="c3__sphere" id="sphere"></div>
</div>
<b class="ld__badge" aria-hidden="true"><span class="ld__badgeNum" id="pct">0%</span><span class="ld__badgeUnit">Progress</span></b>
</div>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// 구면 점 수렴 로더 — 피보나치 구 분포 공식(고정, 무작위 없음)으로 점을 구 표면에 고르게 흩어 두고,
// 진행률 값이 오를수록 각 점의 좌표를 중심(0,0,0) 쪽으로 선형 수축시킨다. 값이 다 차면 모든 점이 한 점에 겹친다.
// 395(캔버스 rAF 물리)·393(포인터 tilt) 과 다른 축 — 구면 분포 공식으로 점을 배치하고 중심 수렴 비율을 계산한다.
$duration: $dur-loop;
$easing: linear;
$color: $subject-blue-deep;
@include stage($stage-ink);
.ld { display: flex; flex-direction: column; gap: $sp-2; width: 100%; max-width: 360px; }
.ld__hint {
margin: 0;
font-weight: 700; font-size: clamp(10px, 2.8vw, 12px); line-height: 1.35;
color: rgba($subject-cream, .78);
text-align: center;
}
.ld__field {
position: relative; height: 208px;
border-radius: $r-card; overflow: hidden;
background: $subject-cream;
box-shadow: inset 0 0 0 1px rgba($subject-ink, .16);
cursor: pointer;
}
.ld__field:focus-visible { outline: 2px solid $subject-blue-light; outline-offset: 2px; }
.c3__scene { position: absolute; inset: 0; perspective: clamp(320px, 70vw, 480px); }
.c3__sphere { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.c3__pt {
position: absolute; left: 0; top: 0;
width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
border-radius: 50%;
background: $color;
will-change: transform;
}
.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, .78);
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__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: #17141a;
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: 360px;
}
.ld__hint {
margin: 0;
font-weight: 700;
font-size: clamp(10px, 2.8vw, 12px);
line-height: 1.35;
color: rgba(255, 247, 230, 0.78);
text-align: center;
}
.ld__field {
position: relative;
height: 208px;
border-radius: 16px;
overflow: hidden;
background: #fff7e6;
box-shadow: inset 0 0 0 1px rgba(23, 20, 26, 0.16);
cursor: pointer;
}
.ld__field:focus-visible {
outline: 2px solid #5b8cf8;
outline-offset: 2px;
}
.c3__scene {
position: absolute;
inset: 0;
perspective: clamp(320px, 70vw, 480px);
}
.c3__sphere {
position: absolute;
left: 50%;
top: 50%;
width: 0;
height: 0;
transform-style: preserve-3d;
}
.c3__pt {
position: absolute;
left: 0;
top: 0;
width: 7px;
height: 7px;
margin: -3.5px 0 0 -3.5px;
border-radius: 50%;
background: #0a4fe8;
will-change: transform;
}
.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.78);
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__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 () {
'use strict';
var root = document.getElementById('ld');
var field = document.getElementById('field');
var pctEl = document.getElementById('pct');
var sphere = document.getElementById('sphere');
var POINT_COUNT = 28;
var SPHERE_R = 78;
var GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5)); // 피보나치 구 분포 각(고정 상수, 무작위 없음)
var ROT_TURNS = 0.5;
// 피보나치 구 분포 — 점 i 의 구면 좌표를 결정적으로 계산한다.
var BASE = [];
for (var i = 0; i < POINT_COUNT; i++) {
var y = 1 - (i / (POINT_COUNT - 1)) * 2;
var r = Math.sqrt(Math.max(0, 1 - y * y));
var theta = GOLDEN_ANGLE * i;
BASE.push([Math.cos(theta) * r * SPHERE_R, y * SPHERE_R, Math.sin(theta) * r * SPHERE_R]);
}
var pts = [];
for (var pi = 0; pi < POINT_COUNT; pi++) {
var el = document.createElement('div');
el.className = 'c3__pt';
sphere.appendChild(el);
pts.push(el);
}
var reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
var LOOP = 2;
var REDUCE_P = 0.7;
var t0 = 0, raf = 0, paused = false, lastP = 0;
function render(p) {
lastP = p;
var rotY = (p * 360 * ROT_TURNS) % 360;
var shrink = 1 - p; // 중심(0,0,0) 으로의 수렴 비율
sphere.style.transform = 'rotateY(' + rotY + 'deg) rotateX(14deg)';
for (var i = 0; i < POINT_COUNT; i++) {
var b = BASE[i];
var x = b[0] * shrink, y = b[1] * shrink, z = b[2] * shrink;
pts[i].style.transform = 'translate3d(' + x + 'px,' + y + 'px,' + z + 'px)';
}
pctEl.textContent = Math.round(p * 100) + '%';
}
function frame(now) {
if (!paused) { var t = (now - t0) / 1000; render((t % LOOP) / LOOP); }
raf = requestAnimationFrame(frame);
}
function togglePause() {
paused = !paused;
root.classList.toggle('is-paused', paused);
render(reduce ? REDUCE_P : lastP);
}
function restart() {
t0 = performance.now();
render(reduce ? REDUCE_P : 0);
}
field.addEventListener('click', function () { togglePause(); });
field.addEventListener('keydown', function (e) {
if (e.key === ' ' || e.key === 'Enter') { e.preventDefault(); togglePause(); }
else if (e.key === 'r' || e.key === 'R') { e.preventDefault(); restart(); }
});
window.addEventListener('resize', function () {
if (paused || reduce) render(reduce ? REDUCE_P : lastP);
});
t0 = performance.now();
if (reduce) {
root.classList.add('is-still');
render(REDUCE_P);
} else {
raf = requestAnimationFrame(frame);
}
})();// SpherePointConverge — vanilla 판(run/399/demo/05-loader-3d-sphere-point-converge/index.html) 의 React 포트.
// 피보나치 구 분포 공식(고정, 무작위 없음)으로 점을 구 표면에 배치하고, 진행률 값이 오를수록
// 각 점의 좌표를 중심(0,0,0) 쪽으로 선형 수축시킨다.
// 395(캔버스 rAF 물리)·393(포인터 tilt) 과 다른 축 — 구면 분포 공식으로 점을 배치하고 중심 수렴 비율을 계산한다.
import { useEffect, useRef } from "react";
import type { CSSProperties } from "react";
import styles from "./SpherePointConverge.module.scss";
export type SpherePointConvergeProps = {
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 POINT_COUNT = 28;
const SPHERE_R = 78;
const GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5));
const ROT_TURNS = 0.5;
const LOOP = 2;
const REDUCE_P = 0.7;
const FIELD_LABEL = "구면 점 수렴 진행 실험판";
const BASE: [number, number, number][] = Array.from({ length: POINT_COUNT }, (_, i) => {
const y = 1 - (i / (POINT_COUNT - 1)) * 2;
const r = Math.sqrt(Math.max(0, 1 - y * y));
const theta = GOLDEN_ANGLE * i;
return [Math.cos(theta) * r * SPHERE_R, y * SPHERE_R, Math.sin(theta) * r * SPHERE_R];
});
export default function SpherePointConverge({
duration = "2s",
easing = "linear",
color = "#0a4fe8",
}: SpherePointConvergeProps) {
const rootRef = useRef<HTMLDivElement | null>(null);
const fieldRef = useRef<HTMLDivElement | null>(null);
const sphereRef = useRef<HTMLDivElement | null>(null);
const pctRef = useRef<HTMLSpanElement | null>(null);
const ptsRef = useRef<(HTMLDivElement | null)[]>(new Array(POINT_COUNT).fill(null)) as Box<(HTMLDivElement | null)[]>;
const pausedRef = useRef(false) as Box<boolean>;
const lastPRef = useRef(0) as Box<number>;
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 render(p: number): void {
lastPRef.current = p;
const rotY = (p * 360 * ROT_TURNS) % 360;
const shrink = 1 - p;
const sphere = sphereRef.current;
if (sphere) sphere.style.transform = "rotateY(" + rotY + "deg) rotateX(14deg)";
const pts = ptsRef.current;
for (let i = 0; i < POINT_COUNT; i++) {
const el = pts[i];
if (!el) continue;
const [bx, by, bz] = BASE[i];
const x = bx * shrink, y = by * shrink, z = bz * shrink;
el.style.transform = "translate3d(" + x + "px," + y + "px," + z + "px)";
}
if (pctRef.current) pctRef.current.textContent = Math.round(p * 100) + "%";
}
function togglePause(): void {
pausedRef.current = !pausedRef.current;
const root = rootRef.current;
if (root) root.classList.toggle("is-paused", pausedRef.current);
render(reduced() ? REDUCE_P : lastPRef.current);
}
function restart(): void {
t0Ref.current = performance.now();
render(reduced() ? REDUCE_P : 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()) render(reduced() ? REDUCE_P : lastPRef.current);
}
function frame(now: number): void {
if (!pausedRef.current) {
const t = (now - t0Ref.current) / 1000;
render((t % LOOP) / LOOP);
}
rafRef.current = requestAnimationFrame(frame);
}
useEffect(() => {
t0Ref.current = performance.now();
window.addEventListener("resize", onResize);
if (reduced()) {
const root = rootRef.current;
if (root) root.classList.add("is-still");
render(REDUCE_P);
} 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}>클릭하거나 스페이스바를 누르면 멈추거나 다시 갑니다</p>
<div
className={styles.field}
ref={fieldRef}
role="application"
aria-label={FIELD_LABEL}
tabIndex={0}
onClick={onClick}
onKeyDown={onKey}
>
<div className={styles.scene}>
<div className={styles.sphere} ref={sphereRef}>
{BASE.map((_, i) => (
<div key={i} className={styles.pt} ref={(el: HTMLDivElement | null) => { ptsRef.current[i] = el; }} />
))}
</div>
</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>
);
}05 Loader Whose Sphere-Surface Points Converge to a Single Point — Measured area 6.127% · moving frames 23/23Original by GODRICH · SCSS and React ship in the zip · CSS 3D Cube Animation Loaders, 9 Patterns
The post this demo lives in
CSS 3D Cube Animation Loaders, 9 PatternsA css 3d cube animation isn't a keyframe tween: Frame one shows one flat face. Each threshold swaps a cube face, settles See all demos in this post
If you like this effect - similar demos
Loaders03 A Loader Where Points Sampled From Logo Pixels Spring Into PlaceLogo Loading Animation: 9 Progress-Driven Marks
Loaders02 Loader an Arrived-particle Count Value Fills9 CSS Loading Animation Patterns, Canvas Physics
Loaders01 Halo Ring AI Loader Whose Hue Value Turns Toward DoneAI Loading Animation: 9 Patterns by One Value