Thinking orbs
Orbs that think while you wait: nine loading states for AI interfaces.
working
Particles on tilted orbits
searching
A scan sweeps a dotted globe
solving
Bands scramble, then click back
listening
A waveform rolls through the rings
connecting
A constellation wires itself
weaving
Three strands plait around a sphere
composing
An undulating multi-band sash
breathing
A ring, slowly morphing
shaping
Circle to triangle to square
Playground
<script>
import { ThinkingOrb } from 'runeglow/thinking-orbs';
</script>
<ThinkingOrb state="listening" />Install
pnpm add runeglow Or copy just this library’s source into your project, with the shadcn-svelte CLI:
npx shadcn-svelte@latest add https://runeglow.dev/r/thinking-orbs.json import { ThinkingOrb } from 'runeglow/thinking-orbs';Usage
One element, no wrapper. It draws on a plain 2D canvas, so there is no WebGL to set up.
<script>
import { ThinkingOrb } from 'runeglow/thinking-orbs';
</script>
<ThinkingOrb state="searching" />At size={20} it sits inline with text. When a visible label says
the same thing, hide the orb from screen readers.
<script>
import { ThinkingOrb } from 'runeglow/thinking-orbs';
let busy = $state(true);
</script>
{#if busy}
<p class="status">
<ThinkingOrb state="working" size={20} aria-hidden="true" />
Working…
</p>
{/if}Tint it, change its pace and density, or reach into the engine’s own options through opts.
<ThinkingOrb
state="connecting"
color="#7cd4ff"
speed={1.4}
dots={1.5}
opts={{ thr: 0.9, signals: 8 }}
/>The geometry is also available on its own, with no Svelte and no DOM, for drawing on a canvas of your own.
import { resolvePreset, MODE_FRAMES } from 'runeglow/thinking-orbs/engine';
const { mode, speed, opts } = resolvePreset('searching', 64);
const { dots, lines } = MODE_FRAMES[mode](64, seconds * speed, opts);
// dots and lines are z-sorted and final: draw them in order.Props
state 'working' | 'searching' | 'solving' | 'listening' | 'connecting' | 'weaving' | 'composing' | 'breathing' | 'shaping' 'working' Which animation to show.size 64 | 32 | 20 64 A tuned preset, not a scale factor. 64 is avatar scale, 20 sits inline with text, 32 is interpolated between them.theme 'auto' | 'dark' | 'light' 'auto' auto follows a data-theme attribute or dark/light class on an ancestor, then prefers-color-scheme. dark draws light dots, light draws dark dots.speed number 1 Multiplier on top of the preset’s own speed.paused boolean false Freezes the animation on the current frame.color string – Ink tint as #rgb, #rrggbb or rgb(). The depth shading is kept. Omit for grayscale.dots number 1 Density multiplier: 0.5 halves the dots, 2 doubles them.dotSize number 1 Radius multiplier for every dot.opts ModeOpts – Raw engine options merged over the preset. Which keys do something depends on the state; the playground lists them.frame ModeFrame – Replaces the state’s geometry with your own function: (size, t, opts) => { dots, lines }.gravity boolean | GravityOptions – Bends a drawn pointer toward the orb as it comes near. Needs a pointer raster as gravity.sprite.ref HTMLCanvasElement | null – The canvas element. Bindable with bind:ref....rest HTMLCanvasAttributes – class, style, aria-label and any other attribute are forwarded to the canvas.Gravity options
sprite CursorSprite – The pointer raster: { src, width, height, hotX, hotY }. Without one, gravity stays off.reach number 160 How far outside the orb the pull is felt, in px.strength number 11 Length of the tail the pointer trails toward the orb, in px.deform number 19 How far the pointer’s body bends toward the orb, in px. The tip stays put.taper number 1.95 1 to 4. Higher keeps the tip firm and bends the far end hardest.curve number 2.8 1 to 4. Higher keeps the pointer whole until it is close.falloff number 24 Width of the band across the pointer over which the tail fades, in px.smoothing number 0.3 0 to 1. How much the bend lags the pointer.handover number 0.6 0 to 1. How slowly the pull swings from one orb to the next.squash number 1.2 0 to 3. Extra bend when the orb is off the tip’s side.blur number 1 Blur at the far end of the tail, in px.fadeMs number 180 Fade in and out as the pointer enters and leaves, in ms.Notes
- Each orb labels itself from its state (“Searching…”). Pass
aria-labelto change the wording. - Orbs pause while offscreen or in a hidden tab, and show a single still frame under
prefers-reduced-motion. - Gravity hides the real pointer near an orb and draws a raster in its place, so the raster should match the platform’s pointer. It turns itself off on touch devices, zoomed pages and under reduced motion.
- All mounted orbs share one clock, so several on a page stay in phase.