Skip to main content

Utils

Collection of utility functions.

Constants

DEG2RAD

const DEG2RAD: number;

Conversion factor from degrees to radians.

RAD2DEG

const RAD2DEG: number;

Conversion factor from radians to degrees.

Functions

createRef

function createRef<T>(): Signal<T | null>;

Creates a reference signal.

makeRef

function makeRef<T>(initial: T): Signal<T>;

Creates a reference signal with an initial value.

makeRefs

function makeRefs<T>(obj: T): T;

Creates references for each property of an object.

createRefArray

function createRefArray<T>(length: number): Signal<T[]>;

Creates a reference array.

createRefMap

function createRefMap<K, V>(): Signal<Map<K, V>>;

Creates a reference map.

range

function range(start: number, end?: number, step?: number): number[];

Generates a numeric range sequence.

debug

function debug(...args: unknown[]): void;

Outputs debug information to the console.

useDuration

function useDuration(duration: number): ThreadGenerator;

Uses the specified duration.

useRandom

function useRandom(): Random;

Gets the random number generator of the current scene.

useScene

function useScene<T extends Scene = Scene>(): T;

Gets the current scene.

finishScene

function finishScene(): void;

Finishes the current scene.

beginSlide

function beginSlide(name: string): void;

Begins the specified slide.