Skip to content

Wiggle API / Builder

Interface: Builder ​

Properties ​

center ​

readonly center: [number, number]

The canvas center, in pixels.


fps ​

readonly fps: number


height ​

readonly height: number


width ​

readonly width: number

Methods ​

add() ​

add<T>(node): T

Add a node or group to the composition and return it.

Type Parameters ​

T ​

T extends Node | Group

Parameters ​

node ​

T

Returns ​

T


audio() ​

audio(path, options?): void

Add a music bed under the whole composition. gain is the held volume (0..1); the volume ramps up over fadeIn and down over fadeOut.

Parameters ​

path ​

string

options? ​
fadeIn? ​

Duration

fadeOut? ​

Duration

gain? ​

number

Returns ​

void


group() ​

group(options?): Group

Create a group, positioned at the canvas center unless given x and y.

Parameters ​

options? ​
x? ​

number

y? ​

number

Returns ​

Group


scene() ​

scene(duration, build): void

Add a scene that plays for duration. Scenes play in order. Calling scene() puts the composition in scene mode and the total duration is the sum of the scenes minus the transition overlaps.

Parameters ​

duration ​

Duration

build ​

(s) => void

Returns ​

void


svg() ​

svg(path, options?): SVGGroup

Import an SVG file as a group of vector path layers, centered on the canvas unless given x and y. Each shape in the file becomes a child layer, so the drawing can be animated as a whole through the returned group. The path is resolved relative to the composition script.

Parameters ​

path ​

string

options? ​
x? ​

number

y? ​

number

Returns ​

SVGGroup


transition() ​

transition(options?): void

Place a transition before the next scene, overlapping it with the previous scene. Default "slide" over 0.5s.

Parameters ​

options? ​
duration? ​

Duration

type? ​

"slide" | "fade"

Returns ​

void