VisorVisor
ComponentsVisual Elements

Sphere

GPU-accelerated particle sphere visualization with 256K particles, 6 geometry modes, 5 color schemes, and think-mode animation effects.

Preview

SSR Compatibility

Sphere uses "use client" and dynamically imports Three.js inside useEffect. It renders an empty <div> during SSR and hydrates the WebGL canvas on the client. No additional configuration is needed for Next.js.

Geometry Modes

Six particle distribution algorithms, each with unique shader displacement:

ModeDescription
sphereFibonacci sphere with dual-layer noise displacement and tangential swirl
curlCurl noise flow field along the sphere surface
turingReaction-diffusion pattern (activator-inhibitor model)
lorenzLorenz strange attractor trajectory sampling
tendrils80 radial tendrils emanating from the sphere surface
<Sphere mode="lorenz" colorScheme="ember" />

Color Schemes

Five built-in gradient schemes (5 stops each, bottom to top):

SchemeDescription
solarWarm gold to cool blue-white (default)
aquaDeep teal to bright cyan
emberDeep red-brown to warm off-white
auroraGreen to purple northern lights
ghostMonochrome grayscale

Custom Colors

Override with a 5-stop gradient array (RGB values in 0-1 range):

<Sphere
  colors={[
    [0.1, 0.0, 0.3],
    [0.3, 0.0, 0.6],
    [0.5, 0.1, 0.8],
    [0.7, 0.3, 0.9],
    [0.9, 0.6, 1.0],
  ]}
/>

Think Mode

The sphere supports a "thinking" animation with three layered effects:

  • Pulses — Expanding ring waves from random surface points
  • Ramp — Speed boost during think intensity
  • Scatter — Staccato heartbeat contractions that scatter particles outward

Declarative Control

<Sphere thinkIntensity={0.8} thinkEffects={{ pulses: true, ramp: true, scatter: true }} />

Imperative Control

Use a ref for start/stop with automatic ease ramping:

const sphereRef = useRef<SphereRef>(null);

<Sphere ref={sphereRef} />

// Start thinking (automatic ease-in)
sphereRef.current?.startThinking();

// Stop thinking (automatic ease-out)
sphereRef.current?.stopThinking();

Visual Tuning

Fine-tune the visualization appearance:

<Sphere
  speed={1.5}       // Animation speed multiplier
  waves={2}         // Noise displacement intensity
  dotSize={0.8}     // Particle size
  blur={0.6}        // Softness (0 = hard dots, 1 = full glow)
  saturation={1.2}  // Color saturation
  lightness={0.9}   // Color lightness
  scale={1.0}       // Overall scale
/>

Orbit Controls

Drag to rotate, scroll to zoom. Disable with orbitControls={false}.

<Sphere orbitControls autoRotate autoRotateSpeed={0.5} />

Reduced Motion

When prefers-reduced-motion: reduce is active, the animation freezes in place and auto-rotation stops. The sphere remains visible as a static image. Orbit controls still respond to user interaction.

Ref API

MethodDescription
startThinking()Start think mode with automatic ease-in ramp
stopThinking()Stop think mode with automatic ease-out ramp
getThinkIntensity()Get current think intensity (0-1)
setThinkIntensity(value)Set think intensity directly (0-1)
setMode(mode)Switch geometry mode
setColorScheme(scheme)Apply a named color scheme
setColors(colors)Apply custom gradient colors
resetCamera()Animated camera reset to default position
dispose()Force dispose of all GPU resources

Performance

  • 256K particles rendered in a single GPU draw call (THREE.Points)
  • All visual computation runs in GLSL shaders — CPU updates ~10 uniforms per frame
  • Additive blending creates natural bright hotspots without extra computation
  • Device pixel ratio clamped to 2 by default (maxPixelRatio prop)
  • Targets 60fps on modern hardware

Installation

npx visor add sphere

This installs three (~150KB gzipped) as a dependency. If your project already uses Three.js, the existing installation will be reused.

Usage

import { Sphere } from '@/components/visual/sphere/sphere';

<div style={{ width: '100%', height: '400px' }}>
  <Sphere colorScheme="solar" mode="sphere" />
</div>

The Sphere component fills its container. Wrap it in a sized element.

API Reference

SphereProps

PropTypeDefaultDescription
mode'sphere' | 'curl' | 'turing' | 'lorenz' | 'tendrils''sphere'Geometry mode for particle distribution.
colorScheme'solar' | 'aqua' | 'ember' | 'aurora' | 'ghost''solar'Named color scheme. Overridden by colors if both are provided.
colorsGradientColorsCustom 5-stop gradient colors (RGB 0-1 range). Overrides colorScheme.
particleCountnumber256000Number of particles rendered.
radiusnumber1.2Sphere radius.
scalenumber1.0Overall scale multiplier.
speednumber1.0Animation speed multiplier.
wavesnumber1.0Noise displacement multiplier (wave amplitude).
dotSizenumber1.0Particle size multiplier.
blurnumber0.5Particle softness (0 = hard dots, 1 = full glow).
saturationnumber1.0Color saturation multiplier.
lightnessnumber1.0Color lightness multiplier.
thinkIntensitynumber0Think-mode intensity (0–1). Controls layered animation effects.
thinkEffectsSphereThinkEffectsWhich think-mode effects are enabled (pulses, ramp, scatter). All enabled by default.
orbitControlsbooleantrueEnable drag-to-rotate orbit controls.
autoRotatebooleantrueEnable automatic rotation.
autoRotateSpeednumber0.5Auto-rotation speed.
maxPixelRationumber2Max device pixel ratio (clamped for performance).
backgroundColornumber0x000000Background color as a hex number.
classNamestringAdditional CSS class for the container div.
styleReact.CSSPropertiesInline style for the container div.

Accessibility

  • The sphere is a purely decorative visualization — it conveys no information that must be accessible.
  • Wrap in aria-hidden="true" when used as pure decoration so screen readers skip it entirely.
  • prefers-reduced-motion is respected: animation and auto-rotation stop automatically when the OS setting is active.
  • Do not use Sphere as a primary means of conveying status or data — pair it with text or other accessible indicators.
{/* Decorative usage */}
<div aria-hidden="true">
  <Sphere colorScheme="solar" />
</div>