Skip to content

Wormhole API

Wormhole

Extends Effect.

Factory Function

typescript
createWormhole(config?: WormholeConfig)

Methods

See Effect for the full method reference: mount(), start(), pause(), resume(), configure(), withFade(), and destroy().


WormholeConfig

typescript
interface WormholeConfig {
    count?: number;
    speed?: number;
    color?: string;
    direction?: WormholeDirection;
    scale?: number;
}
PropertyTypeDefaultDescription
countnumber200Number of particles. Automatically halved on small screens.
speednumber1Global speed multiplier for particle movement.
colorstring'#6699ff'Particle and glow color (hex string).
directionWormholeDirection'inward'Direction of particle flow.
scalenumber1Global scale factor for particle sizes and trails.

WormholeDirection

typescript
type WormholeDirection = 'inward' | 'outward';
DirectionDescription
inwardParticles flow from the edges toward the center, accelerating as they approach.
outwardParticles flow from the center outward, accelerating as they move away.

WormholeParticle

Internal representation of a wormhole particle in polar coordinates.

typescript
type WormholeParticle = {
    angle: number;      // Angular position in radians
    distance: number;   // Distance from center in pixels
    speed: number;      // Base radial speed
    size: number;       // Particle size
    brightness: number; // Base brightness (0-1)
    trail: number;      // Trail length in pixels
};