Connect
React + Tailwind
const T = 3.2;
const GRID = [20, 50, 80];
// A spiral out from the centre that crosses every dot, each one 30 units on from the last.
const PATH = [
[50, 50],
[80, 50],
[80, 80],
[20, 80],
[20, 20],
[80, 20],
];
const START = 0.02;
const DRAW = 0.6; // the line is drawn by here
const HOLD = 0.74;
const GONE = 0.86;
const pct = (t: number) => `${(t * 100).toFixed(2)}%`;
const segs = PATH.slice(1).map((p, i) => ({ a: PATH[i], b: p, len: Math.hypot(p[0] - PATH[i][0], p[1] - PATH[i][1]) }));
const TOTAL = segs.reduce((s, g) => s + g.len, 0);
const when = (dist: number) => START + ((DRAW - START) * dist) / TOTAL;
// How far along the line each grid dot is reached.
function reach(x: number, y: number) {
let run = 0;
for (const { a, b, len } of segs) {
const cross = (b[0] - a[0]) * (y - a[1]) - (b[1] - a[1]) * (x - a[0]);
const along = ((x - a[0]) * (b[0] - a[0]) + (y - a[1]) * (b[1] - a[1])) / len;
if (Math.abs(cross) < 1e-6 && along >= -1e-6 && along <= len + 1e-6) return run + along;
run += len;
}
return TOTAL;
}
const DOTS = GRID.flatMap((y) => GRID.map((x) => ({ x, y, t: when(reach(x, y)) })));
const vertexTimes: number[] = [];
PATH.reduce((d, p, i) => {
const next = i ? d + segs[i - 1].len : 0;
vertexTimes.push(when(next));
return next;
}, 0);
const touch = [
`0% { transform: translate(${PATH[0][0]}px, ${PATH[0][1]}px); opacity: 0; }`,
...PATH.map((p, i) => `${pct(vertexTimes[i])} { transform: translate(${p[0]}px, ${p[1]}px); opacity: 1; }`),
`${pct(DRAW + 0.04)} { transform: translate(${PATH.at(-1)![0]}px, ${PATH.at(-1)![1]}px); opacity: 0; }`,
`100% { transform: translate(${PATH.at(-1)![0]}px, ${PATH.at(-1)![1]}px); opacity: 0; }`,
].join('\n ');
const css = `
.loader-connect { --ink: light-dark(#373a40, #f1f2f3); --dim: light-dark(#cbced3, #393c41); display: inline-block; font-size: 108px; width: 1em; height: 1em; }
.loader-connect svg { display: block; width: 100%; height: 100%; }
.loader-connect__line { fill: none; stroke: color-mix(in oklab, var(--ink) 55%, transparent); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: ${TOTAL} ${TOTAL + 60}; stroke-dashoffset: ${TOTAL}; animation: loader-connect-draw ${T}s linear infinite; }
.loader-connect__touch { fill: color-mix(in oklab, var(--ink) 18%, transparent); animation: loader-connect-touch ${T}s linear infinite; }
.loader-connect__dot { fill: var(--dim); transform-box: fill-box; transform-origin: center; animation: ${T}s infinite; }
@keyframes loader-connect-draw {
0%, ${pct(START)} { stroke-dashoffset: ${TOTAL}; opacity: 1; }
${pct(DRAW)}, ${pct(HOLD)} { stroke-dashoffset: 0; opacity: 1; }
${pct(GONE)}, 100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes loader-connect-touch {
${touch}
}
${DOTS.map(
(d, i) => `.loader-connect__dot:nth-of-type(${i + 1}) { animation-name: loader-connect-dot-${i}; }
@keyframes loader-connect-dot-${i} {
0%, ${pct(d.t - 0.005)} { fill: var(--dim); scale: 1; }
${pct(d.t)} { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
${pct(d.t + 0.07)}, ${pct(HOLD)} { fill: var(--ink); scale: 1.35; }
${pct(GONE)}, 100% { fill: var(--dim); scale: 1; }
}`,
).join('\n ')}
@media (prefers-reduced-motion: reduce) {
.loader-connect__line, .loader-connect__dot { animation: none !important; }
.loader-connect__line { stroke-dashoffset: 0; }
.loader-connect__dot { fill: var(--ink); scale: 1.35; }
.loader-connect__touch { display: none; }
}
`;
export function Preview() {
return (
<>
<style href="kit-loaders-connect" precedence="kit">
{css}
</style>
<div className="loader-connect" role="status" aria-label="Loading">
<svg viewBox="0 0 100 100" aria-hidden="true">
<path className="loader-connect__line" d={`M${PATH.map((p) => p.join(' ')).join(' L')}`} />
{DOTS.map((d) => (
<circle key={`${d.x}-${d.y}`} className="loader-connect__dot" cx={d.x} cy={d.y} r="4.5" />
))}
<circle className="loader-connect__touch" cx="0" cy="0" r="10" />
</svg>
</div>
</>
);
}Markup where the component goes, CSS in your stylesheet. No JavaScript.
HTML
<div class="loader-connect" role="status" aria-label="Loading">
<svg viewBox="0 0 100 100" aria-hidden="true">
<path class="loader-connect__line" d="M50 50 L80 50 L80 80 L20 80 L20 20 L80 20"></path>
<circle class="loader-connect__dot" cx="20" cy="20" r="4.5"></circle>
<circle class="loader-connect__dot" cx="50" cy="20" r="4.5"></circle>
<circle class="loader-connect__dot" cx="80" cy="20" r="4.5"></circle>
<circle class="loader-connect__dot" cx="20" cy="50" r="4.5"></circle>
<circle class="loader-connect__dot" cx="50" cy="50" r="4.5"></circle>
<circle class="loader-connect__dot" cx="80" cy="50" r="4.5"></circle>
<circle class="loader-connect__dot" cx="20" cy="80" r="4.5"></circle>
<circle class="loader-connect__dot" cx="50" cy="80" r="4.5"></circle>
<circle class="loader-connect__dot" cx="80" cy="80" r="4.5"></circle>
<circle class="loader-connect__touch" cx="0" cy="0" r="10"></circle>
</svg>
</div>CSS
.loader-connect { --ink: light-dark(#373a40, #f1f2f3); --dim: light-dark(#cbced3, #393c41); display: inline-block; font-size: 108px; width: 1em; height: 1em; }
.loader-connect svg { display: block; width: 100%; height: 100%; }
.loader-connect__line { fill: none; stroke: color-mix(in oklab, var(--ink) 55%, transparent); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 240 300; stroke-dashoffset: 240; animation: loader-connect-draw 3.2s linear infinite; }
.loader-connect__touch { fill: color-mix(in oklab, var(--ink) 18%, transparent); animation: loader-connect-touch 3.2s linear infinite; }
.loader-connect__dot { fill: var(--dim); transform-box: fill-box; transform-origin: center; animation: 3.2s infinite; }
@keyframes loader-connect-draw {
0%, 2.00% { stroke-dashoffset: 240; opacity: 1; }
60.00%, 74.00% { stroke-dashoffset: 0; opacity: 1; }
86.00%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes loader-connect-touch {
0% { transform: translate(50px, 50px); opacity: 0; }
2.00% { transform: translate(50px, 50px); opacity: 1; }
9.25% { transform: translate(80px, 50px); opacity: 1; }
16.50% { transform: translate(80px, 80px); opacity: 1; }
31.00% { transform: translate(20px, 80px); opacity: 1; }
45.50% { transform: translate(20px, 20px); opacity: 1; }
60.00% { transform: translate(80px, 20px); opacity: 1; }
64.00% { transform: translate(80px, 20px); opacity: 0; }
100% { transform: translate(80px, 20px); opacity: 0; }
}
.loader-connect__dot:nth-of-type(1) { animation-name: loader-connect-dot-0; }
@keyframes loader-connect-dot-0 {
0%, 45.00% { fill: var(--dim); scale: 1; }
45.50% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
52.50%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
.loader-connect__dot:nth-of-type(2) { animation-name: loader-connect-dot-1; }
@keyframes loader-connect-dot-1 {
0%, 52.25% { fill: var(--dim); scale: 1; }
52.75% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
59.75%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
.loader-connect__dot:nth-of-type(3) { animation-name: loader-connect-dot-2; }
@keyframes loader-connect-dot-2 {
0%, 59.50% { fill: var(--dim); scale: 1; }
60.00% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
67.00%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
.loader-connect__dot:nth-of-type(4) { animation-name: loader-connect-dot-3; }
@keyframes loader-connect-dot-3 {
0%, 37.75% { fill: var(--dim); scale: 1; }
38.25% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
45.25%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
.loader-connect__dot:nth-of-type(5) { animation-name: loader-connect-dot-4; }
@keyframes loader-connect-dot-4 {
0%, 1.50% { fill: var(--dim); scale: 1; }
2.00% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
9.00%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
.loader-connect__dot:nth-of-type(6) { animation-name: loader-connect-dot-5; }
@keyframes loader-connect-dot-5 {
0%, 8.75% { fill: var(--dim); scale: 1; }
9.25% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
16.25%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
.loader-connect__dot:nth-of-type(7) { animation-name: loader-connect-dot-6; }
@keyframes loader-connect-dot-6 {
0%, 30.50% { fill: var(--dim); scale: 1; }
31.00% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
38.00%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
.loader-connect__dot:nth-of-type(8) { animation-name: loader-connect-dot-7; }
@keyframes loader-connect-dot-7 {
0%, 23.25% { fill: var(--dim); scale: 1; }
23.75% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
30.75%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
.loader-connect__dot:nth-of-type(9) { animation-name: loader-connect-dot-8; }
@keyframes loader-connect-dot-8 {
0%, 16.00% { fill: var(--dim); scale: 1; }
16.50% { fill: var(--ink); scale: 1.75; animation-timing-function: cubic-bezier(0.3, 0, 0.3, 1); }
23.50%, 74.00% { fill: var(--ink); scale: 1.35; }
86.00%, 100% { fill: var(--dim); scale: 1; }
}
@media (prefers-reduced-motion: reduce) {
.loader-connect__line, .loader-connect__dot { animation: none !important; }
.loader-connect__line { stroke-dashoffset: 0; }
.loader-connect__dot { fill: var(--ink); scale: 1.35; }
.loader-connect__touch { display: none; }
}Goal: Create a "Connect" loader.
Visual behavior: A line traces a spiral through a three by three grid like an unlock pattern, lighting each dot it reaches, then fades out.
Technique:
- Pure CSS: every motion is a keyframe animation, so the plain HTML version needs no script.
- Everything is sized in em from one font-size on the root, so changing that one value scales the whole loader.
- The spiral starts in the centre and crosses every dot, each one an equal distance along the line, so they light at an even beat.
- The line draws with stroke-dashoffset while a soft touch point follows its end. Each dot has its own keyframes timed from where the line reaches it, so it pops just as the line arrives.
- The finished pattern holds, then the line fades and the dots dim before it starts again.
Accessibility: The root has role="status" and aria-label="Loading"; everything inside it is aria-hidden. Under prefers-reduced-motion the whole pattern shows drawn with every dot lit.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: neutral only. Black, white and grays, no hues. Use the color values above as written, or my project's closest neutral tokens.
Return a single self-contained component. No dependencies.Goal: Create a "Connect" loader.
Visual behavior: A line traces a spiral through a three by three grid like an unlock pattern, lighting each dot it reaches, then fades out.
Technique:
- Pure CSS: every motion is a keyframe animation, so the plain HTML version needs no script.
- Everything is sized in em from one font-size on the root, so changing that one value scales the whole loader.
- The spiral starts in the centre and crosses every dot, each one an equal distance along the line, so they light at an even beat.
- The line draws with stroke-dashoffset while a soft touch point follows its end. Each dot has its own keyframes timed from where the line reaches it, so it pops just as the line arrives.
- The finished pattern holds, then the line fades and the dots dim before it starts again.
Accessibility: The root has role="status" and aria-label="Loading"; everything inside it is aria-hidden. Under prefers-reduced-motion the whole pattern shows drawn with every dot lit.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: use my project's existing color tokens. The color values above are grayscale placeholders. Map each one by its role (surface, text, border, accent, glow) to my theme, and keep their relative lightness so contrast and the effect still read.
Return a single self-contained component. No dependencies.Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Free to use in any project, commercial included. MIT-0, no attribution required. Licence
About this component
A line traces a spiral through a three by three grid like an unlock pattern, lighting each dot it reaches, then fades out.
- Dependencies
- None
- Difficulty
- Intermediate
- Triggers
- continuous, loop, draw
- Techniques
- svg, stroke dashoffset, keyframes
- Reduced motion
- Respected
- Theme
- Light and dark (follows your page's color-scheme)
The root has role="status" and aria-label="Loading"; everything inside it is aria-hidden. Under prefers-reduced-motion the whole pattern shows drawn with every dot lit.