Skip to content

Portal API

Portal

Extends Effect.

Factory Function

typescript
createPortal(config?: PortalConfig)

Methods

See Effect for the full method reference.


PortalConfig

typescript
interface PortalConfig {
    color?: string;
    direction?: PortalDirection;
    particles?: number;
    scale?: number;
    secondaryColor?: string;
    size?: number;
    speed?: number;
}
PropertyTypeDefaultDescription
colorstring'#8844ff'Primary color of the portal rings and inner glow.
directionPortalDirection'inward'Direction of the particle spiral.
particlesnumber100Number of spiraling particles.
scalenumber1Scales all sizes proportionally.
secondaryColorstring'#44aaff'Secondary color for the outer ring and particle trails.
sizenumber0.3Relative portal size (0–1) based on the smallest canvas dimension.
speednumber1Rotation and particle speed multiplier.

PortalDirection

typescript
type PortalDirection = 'inward' | 'outward';

PortalParticle

typescript
interface PortalParticle {
    angle: number;
    radius: number;
    size: number;
    speed: number;
}
PropertyTypeDescription
anglenumberCurrent angle on the spiral path (radians).
radiusnumberDistance from the portal center.
sizenumberParticle size.
speednumberIndividual speed modifier.