Interface ITemplate

Template is the type of the scene template.

Remark

The template is a JSON object that represents the scene. For example:

const template = {
'bg' : { x: 0, y: 0, width: 1900, height: 1080, color: colors.black },
'text' : { x: 100, y: 100, text: 'Hello World', color: colors.white, fontSize: 50 },
'square' : { x: 100, y: 300, width: 200, height: 200, color: colors.blue },
}

The keys of the template are used to find nodes in the scene so they require to be unique. The values of each key can be either INodeWritableProps or ITextNodeWritableProps and is used to manipulate the coordinates of the parent node when nesting.

Remark

Nesting has 1 special case, when nesting a node you need to wrap the props in a props object. For example:

const template = {
'row' : {
props: { x: 60, y: 200 }
}
}

This will create a new node with the key row and the props { x: 60, y: 200 }. The props are used to manipulate the coordinates of the parent node. Without the props object the nested node will not be created or rendered.

interface ITemplate {
    [key: string]: Partial<INodeWritableProps> | Partial<ITextNodeWritableProps> | ITemplate | IProps | null;
}

Indexable

[key: string]: Partial<INodeWritableProps> | Partial<ITextNodeWritableProps> | ITemplate | IProps | null

Generated using TypeDoc