Codeboard.

Project and artwork API

Create documents, address stable IDs, and edit individual layers or elements. Start with the demo walkthrough for an executable project.

Parameter declarations below are extracted from the current source. A value after = is the default; ? marks an optional input. Named data shapes are listed in API types.

StoryboardProject

create

static create(options: ProjectOptions): StoryboardProject;

fromJSON

static fromJSON(input: unknown, options: {
    actor?: string;
} = {}): StoryboardProject;

open

static async open(path: string, options: {
    actor?: string;
} = {}): Promise<StoryboardProject>;

id

get id(): string;

title

get title(): string;

canUndo

get canUndo(): boolean;

canRedo

get canRedo(): boolean;

version

get version(): number;

toJSON

toJSON(): StoryboardDocument;

readAsset

readAsset(id: string): Buffer;

save

async save(path: string, options: {
    overwrite?: boolean;
    expectedVersion?: number;
    assetRoot?: string;
} = {}): Promise<void>;

transaction

transaction<T>(label: string, work: () => T): T;

undo

undo(): boolean;

redo

redo(): boolean;

setMetadata

setMetadata(key: string, value: string): this;

addScene

addScene(name: string, id?: Id): SceneHandle;

addSequence

addSequence(name: string, id?: Id): SequenceHandle;

scene

scene(id: Id): SceneHandle;

panel

panel(id: Id): PanelHandle;

select

select(query: {
    panelId: Id;
    layerId?: Id;
    elementIds?: Id[];
}): Selection;

SequenceHandle

addScene

addScene(name: string, id?: Id): SceneHandle;

SceneHandle

addShot

addShot(name: string, id?: Id): ShotHandle;

ShotHandle

addPanel

addPanel(options: PanelOptions = {}): PanelHandle;

PanelHandle

addRasterLayer

addRasterLayer(name: string, options: LayerOptions = {}, parentGroupId?: Id): LayerHandle;

addVectorLayer

addVectorLayer(name: string, options: LayerOptions = {}, parentGroupId?: Id): LayerHandle;

addGroup

addGroup(name: string, options: LayerOptions = {}, parentGroupId?: Id): LayerHandle;

addMotion

addMotion(label: string, from: Point, to: Point, color = "#d14a32", id?: Id): Id;

revise

revise(changes: Partial<Pick<Panel, "title" | "durationFrames" | "action" | "dialogue" | "camera" | "notes">>): this;

layer

layer(id: Id): LayerHandle;

LayerHandle

rasterSurface

rasterSurface(image: PixelBuffer, options: Partial<Pick<RasterSurface, "id" | "name" | "matrix" | "opacity" | "visible">> = {}): Id;

readPixels

readPixels(elementId: Id, region?: PixelRegion): PixelBuffer;

editPixels

editPixels(elementId: Id, region: PixelRegion, edit: (patch: PixelBuffer) => void): this;

rasterStroke

rasterStroke(points: Point[], brush: BrushPreset, options: StrokeOptions = {}): Id;

erase

erase(points: Point[], brush: BrushPreset, options: Omit<StrokeOptions, "erase"> = {}): Id;

vectorStroke

vectorStroke(points: Point[], options: VectorStrokeOptions = {}): Id;

path

path(commands: PathCommand[], options: {
    id?: Id;
    name?: string;
    fill?: VectorFill;
    stroke?: string;
    strokeWidth?: number;
    opacity?: number;
} = {}): Id;

text

text(text: string, x: number, y: number, options: {
    id?: Id;
    name?: string;
    color?: string;
    font?: string;
    align?: "left" | "center" | "right";
    opacity?: number;
} = {}): Id;

set

set(changes: LayerChanges): this;

edit

edit(elementId: Id, updater: (element: DrawingElement) => DrawingElement): this;

outlineStroke

outlineStroke(elementId: Id): this;

booleanPath

booleanPath(elementId: Id, tool: readonly PathCommand[], operation: PathBooleanOperation): this;

Selection

transform

transform(transform: Partial<Transform>, options: {
    pivot?: Pivot;
} = {}): this;

opacity

opacity(value: number): this;

remove

remove(): void;

On this page