Skip to content

Balloons API

Balloons

Extends Effect.

Factory Function

typescript
createBalloons(config?: BalloonsConfig)

Methods

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


BalloonsConfig

typescript
interface BalloonsConfig {
    count?: number;
    colors?: string[];
    sizeRange?: [number, number];
    speed?: number;
    driftAmount?: number;
    stringLength?: number;
    scale?: number;
}
PropertyTypeDefaultDescription
countnumber15Number of balloons. Automatically halved on small screens.
colorsstring[]['#ff4444', '#4488ff', '#44cc44', '#ffcc00', '#ff88cc', '#8844ff']Balloon fill colors (hex strings).
sizeRange[number, number][25, 45]Min/max balloon radius in pixels (before scale).
speednumber1Rise speed multiplier.
driftAmountnumber1Horizontal drift intensity multiplier.
stringLengthnumber1String length multiplier.
scalenumber1Scales all sizes proportionally.

Balloon

Internal representation of a balloon.

typescript
type Balloon = {
    x: number;           // Normalized X position (0-1)
    y: number;           // Normalized Y position (0-1)
    radiusX: number;     // Horizontal radius in pixels
    radiusY: number;     // Vertical radius in pixels
    color: [number, number, number]; // RGB color
    driftPhase: number;  // Drift oscillation phase
    driftFreq: number;   // Drift frequency
    driftAmp: number;    // Drift amplitude
    riseSpeed: number;   // Individual rise speed
    rotation: number;    // Current rotation angle
    rotationSpeed: number; // Rotation oscillation speed
    stringLength: number;  // String length in pixels
};