Composition.create()
Create a new composition with the specified dimensions.Canvas width in pixels
Canvas height in pixels
The created composition instance
Initialization
Browser
The library auto-initializes in the browser. Simply import and use:Node.js
The library auto-initializes in Node.js as well. The WASM module is loaded automatically:Export Methods
exportPng()
Render the composition and encode as PNG.PNG-encoded image data
exportJpeg()
Render the composition and encode as JPEG.JPEG quality (0-100)
JPEG-encoded image data
exportWebp()
Render the composition and encode as lossless WebP.WebP-encoded image data
renderRgba()
Render the composition and return raw RGBA pixel data.Flat RGBA pixel array (width × height × 4 bytes)
Serialization
serialize()
Serialize the composition to binary format for saving.Serialized composition data
Composition.deserialize()
Deserialize a composition from binary data.Serialized composition data (ArrayBuffer, Uint8Array, or array-like)
The deserialized composition instance
Canvas Operations
resizeCanvas()
Resize the composition canvas.New canvas width
New canvas height
Properties
width
Canvas width in pixels (read-only)
height
Canvas height in pixels (read-only)