Dotsphere

Swift package · MIT

Dotted thought-orbs
for SwiftUI.

Twelve animated status indicators for AI, agents and loading states. Pure Swift, no assets, no dependencies. A native port of thinking-orbs, with three new states, colour palettes and image rendering.

iOS 15 · macOS 12 · tvOS 15 · watchOS 8 · visionOS 1

The phone is live. Pick a state, drag the sliders, unfold it, press Play agent run.

Mocked foldable phone, not a real device
Assistant
connecting
Plan a quiet route to the lake.
Connecting…
mock conversation
Tune
State
Theme
Palette
Presets
Swift

Twelve states

Nine come from the original. The three marked new exist only in Dotsphere. Click one to try it in the phone.

Same maths as the original

The nine original states are a line-by-line translation of the web engine. The tests load the original's own reference file and check every dot: 72 cases, 70,115 values, all within 1e-4. This page runs on the original engine itself, and it agrees with the Swift package to the sixth decimal.

Three more states

Pulsing sends sonar rings out from a beating core. Scanning sweeps a dotted disc. Charging fills a sphere from the bottom, holds, drains.

Colour, still depth-shaded

The original is strictly monochrome and stays the default. Tint it with one colour, or let the colour change with depth, from near to far.

For CarPlay, widgets, Live Activities

Where a live view is not possible, render frames to CGImage or an animated UIImage. A crossfade closes the loop seamlessly, even for states that are not periodic.

Tuning built in

dots, dotSize and opts change count, size and single mode values. DotOrbPlayground gives you the sliders you just used, on device, and prints the call.

Native and calm

A plain Canvas in a TimelineView. It pauses off screen, holds a still frame with Reduce Motion, and every orb shares one clock so they stay in phase.

Add it

Swift Package Manager

.package(url: "https://github.com/farazfarid/dotsphere", from: "1.0.0")

or in Xcode: File ▸ Add Package Dependencies…, paste https://github.com/farazfarid/dotsphere

Use it

import Dotsphere

DotOrb(state: .searching, size: 64)

// inline next to text
HStack { DotOrb(state: .working, size: 20); Text("Thinking…") }

// tuned, tinted
DotOrb(state: .connecting, size: 64, color: .blue, speed: 2,
       dots: 2.2, dotSize: 1.2, opts: ["thr": 0.52, "lineW": 1.9])

Credits

Dotsphere is a Swift port of thinking-orbs by Jakub Antalik. The orbs, their maths, presets and tuning are his work (MIT). If you build for the web, use the original: npm install thinking-orbs, with its own demo. Dotsphere is an unofficial port and not affiliated with the original project. This page uses the original's engine, bundled unchanged, plus the Dotsphere additions.

Dotsphere itself, including the three extra states, palettes and this page, is by Faraz Farid. Both are MIT licensed.