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;
}| Property | Type | Default | Description |
|---|---|---|---|
count | number | 200 | Number of particles. Automatically halved on small screens. |
speed | number | 1 | Global speed multiplier for particle movement. |
color | string | '#6699ff' | Particle and glow color (hex string). |
direction | WormholeDirection | 'inward' | Direction of particle flow. |
scale | number | 1 | Global scale factor for particle sizes and trails. |
WormholeDirection
typescript
type WormholeDirection = 'inward' | 'outward';| Direction | Description |
|---|---|
inward | Particles flow from the edges toward the center, accelerating as they approach. |
outward | Particles 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
};