Orbs / ORB-32

ORB-32

a galaxy marched as gas and dust inside the ball

WebGPU isn't available in this browser

Installation

bash
npx expo install react-native-shader-orbs react-native-webgpu react-native-reanimated react-native-worklets

Usage

typescript
import { ShaderOrb, orb32 } from "react-native-shader-orbs";
typescript
<ShaderOrb orb={orb32} size={280} state="idle" interactive />

Props

Component props

The props you'll use most. The ShaderOrb reference lists all of them.

PropTypeDefaultDescription
state"idle" | "thinking" | "speaking""idle"The mood. Eases the parameters toward that preset.
sizenumber280Width and height in points.
paramsRecord<string, number>Parameter overrides by key, clamped to each range. See the shader params below.
colorsRecord<string, string>Hex colors by key. See the colors below.
volumes{ input?: number; output?: number }Levels from 0 to 1 that the shader reads as input and output loudness.
interactivebooleanfalseTap pulses the orb; holding makes it swell.
quality"auto" | "low" | "medium" | "high" | number"auto"Render scale. Lower is cheaper and softer.
maxFpsnumber60Frame cap.
pausedbooleanfalseStops drawing and keeps the last frame.
onReady() => voidCalled once the first frame is on screen.
onError(error: Error) => voidCalled if the orb can't start. Without it the error is logged once.

Shader params

Pass these through params. Values are clamped to the range shown. integrated parameters are phase clocks: the shader accumulates them over time, so the value acts as a rate.

KeyLabelRangeStepDefault
spinDisc turn integrated0 to 30.010.06
churnGas churn integrated0 to 50.020.25
beatCore beat integrated0 to 120.050.8
twinkleTwinkle rate integrated0 to 120.051.2
camDistCamera distance 1 to 500.37
focalLens 0.15 to 150.052.25
envRadiusEnvelope radius 0.15 to 150.12.6
tiltTilt (0 edge-on) 0 to 1.50.010.85
armsArm count 1 to 612
windArm winding 0 to 80.053.4
raggedArm fray 0 to 120.053
armSharpArm sharpness 0.3 to 80.052.2
falloffDisc falloff 0.3 to 120.051.7
thickDisc thickness 0.01 to 10.0050.035
bulgeCore tightness 2 to 200140
coreCore density 0 to 200.15
turbScaleTurbulence scale 0.5 to 300.19
thresholdClumping 0 to 10.010.35
densityGas density 0.1 to 400.114
absorbDust absorption 0 to 200.13.5
starsStars 0 to 100.051.2
starDensityStar density 0 to 10.010.5
starScaleStar scale 5 to 200148
hueReachHue reach 0.15 to 1.50.010.6
pulseBeat depth 0 to 30.010.2
breatheDisc breathing 0 to 20.010
exposureExposure 0.05 to 500.051.1
contrastContrast 0.15 to 60.051.15
saturationSaturation 0 to 40.021.35
alphaGainAlpha gain 0.05 to 150.12
fillNight fill 0 to 10.010.85
rimRim light 0 to 30.0150.35
edgeEdge sharpness 0 to 10.011
edgeFadeHalo falloff 0.1 to 0.9850.0150.98

Colors

Pass these through colors as hex strings.

KeyLabelDefault
tintTint #ffffff
coreCore #fff3d6
innerInner arms #7fb4ff
outerOuter arms #c46bff
deepNight #04050f
rimRim #8fb0ff

Moods

This orb ships presets for idle, speaking, thinking. Choosing a state eases the parameters toward that preset; anything you pass in params still wins.

Credits

Based on original work by XorDev, via shadercn. The shader is licensed for non-commercial use with attribution; see Licensing and credits.

Ported to React Native by @msobkyy.

Want to change something? Open ORB-32 in the playground.