author
Import
Section titled “Import”import * as api from "@fungi.computer/sprite-zdog/author";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | SceneNode | An opaque node in a renderer-neutral Sprite scene. |
| type alias | Point | A point in Sprite scene space. |
| type alias | BezierStep | One cubic Bezier path segment. |
| type alias | PathStep | One renderer-neutral shape path segment. |
| type alias | Transform | Optional translation, rotation, or scale coordinates. |
| type alias | SceneNodeOptions | Shared renderer-neutral options for one scene node. |
| type alias | PathOptions | Renderer-neutral options for a freeform shape. |
| type alias | EllipseOptions | Renderer-neutral options for an ellipse. |
| type alias | HemisphereOptions | Renderer-neutral options for a hemisphere. |
| type alias | CylinderOptions | Renderer-neutral options for a cylinder. |
| type alias | SceneBuilder | The complete renderer-neutral scene authoring surface. |
| type alias | MotionSpec | A named motion applied while presenting a Sprite. |
| type alias | StandardActivity | The standard presentation activity names accepted by every Sprite. |
| type alias | StateGeometry | Variant selections applied to one expression or activity. |
| type alias | MouthCycleStep | One timed mouth state in a speaking cycle. |
| type alias | ActivitySpec | Presentation behavior associated with an activity. |
| type alias | ExpressionSpec | Variant and motion behavior associated with an expression. |
| type alias | BuildResult | The root and named variants produced by one author build. |
| type alias | AuthorContext | Renderer-neutral capabilities available while authoring a Sprite. |
| type alias | SpriteDefinitionInput | Input accepted by the Sprite authoring seam. |
| type alias | SpriteDefinition | An authored Sprite definition preserving the author’s input shape. |
| type alias | SpriteCheckResult | A compact receipt describing one already-authored Sprite definition. |
| constant | STANDARD_ACTIVITIES | The standard presentation activities every Sprite understands. |
| function | defineSprite() | Validate and freeze one renderer-neutral Sprite definition. |
| function | check() | Return a compact, machine-readable receipt for an already authored definition. |
SceneNodetype alias
Section titled “SceneNode”type SceneNode = object;An opaque node in a renderer-neutral Sprite scene.
Properties
Section titled “Properties”[sceneNodeBrand]
Section titled “[sceneNodeBrand]”readonly [sceneNodeBrand]: true;Nominal marker that keeps renderer details out of the author surface.
Pointtype alias
Section titled “Point”type Point = object;A point in Sprite scene space.
Properties
Section titled “Properties”readonly x: number;Horizontal scene coordinate.
readonly y: number;Vertical scene coordinate.
readonly optional z?: number;Optional depth coordinate.
BezierSteptype alias
Section titled “BezierStep”type BezierStep = object;One cubic Bezier path segment.
Properties
Section titled “Properties”bezier
Section titled “bezier”readonly bezier: readonly [Point, Point, Point];Two control points followed by the segment endpoint.
PathSteptype alias
Section titled “PathStep”type PathStep = Point | BezierStep;One renderer-neutral shape path segment.
Transformtype alias
Section titled “Transform”type Transform = object;Optional translation, rotation, or scale coordinates.
Properties
Section titled “Properties”readonly optional x?: number;Optional horizontal component.
readonly optional y?: number;Optional vertical component.
readonly optional z?: number;Optional depth component.
SceneNodeOptionstype alias
Section titled “SceneNodeOptions”type SceneNodeOptions = object;Shared renderer-neutral options for one scene node.
Properties
Section titled “Properties”readonly optional name?: string;Definition-local name used by authored references.
parent?
Section titled “parent?”readonly optional parent?: SceneNode;Parent node in the same definition.
readonly optional x?: number;Horizontal translation that takes precedence over translate.x.
readonly optional y?: number;Vertical translation that takes precedence over translate.y.
readonly optional z?: number;Depth translation that takes precedence over translate.z.
translate?
Section titled “translate?”readonly optional translate?: Transform;Translation components not supplied by the direct coordinates.
rotate?
Section titled “rotate?”readonly optional rotate?: Transform;Rotation around each scene axis, in radians.
scale?
Section titled “scale?”readonly optional scale?: Transform;Scale applied along each scene axis.
visible?
Section titled “visible?”readonly optional visible?: boolean;Whether the node participates in rendering.
color?
Section titled “color?”readonly optional color?: string;Literal paint or an opaque reference returned by color.
stroke?
Section titled “stroke?”readonly optional stroke?: number | false;A false stroke keeps a solid primitive edge-free, as in Zdog fills.
readonly optional fill?: boolean;backface?
Section titled “backface?”readonly optional backface?: string;Optional rear/forward surface palette slots for 3D solids.
frontFace?
Section titled “frontFace?”readonly optional frontFace?: string;Paint used for a primitive’s front face when supported.
updateSort?
Section titled “updateSort?”readonly optional updateSort?: boolean;Whether supported primitives update child depth ordering.
PathOptionstype alias
Section titled “PathOptions”type PathOptions = object & SceneNodeOptions;Renderer-neutral options for a freeform shape.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
path? |
readonly PathStep[] |
Ordered points and cubic Bezier segments in the path. |
closed? |
boolean |
Whether the renderer closes the path. |
EllipseOptionstype alias
Section titled “EllipseOptions”type EllipseOptions = object & SceneNodeOptions;Renderer-neutral options for an ellipse.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
width |
number |
Horizontal diameter. |
height |
number |
Vertical diameter. |
HemisphereOptionstype alias
Section titled “HemisphereOptions”type HemisphereOptions = object & SceneNodeOptions;Renderer-neutral options for a hemisphere.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
diameter |
number |
Diameter of the hemisphere’s base. |
CylinderOptionstype alias
Section titled “CylinderOptions”type CylinderOptions = object & SceneNodeOptions;Renderer-neutral options for a cylinder.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
diameter |
number |
Diameter of the cylinder’s circular faces. |
length |
number |
Distance between the cylinder’s faces. |
SceneBuildertype alias
Section titled “SceneBuilder”type SceneBuilder = object;The complete renderer-neutral scene authoring surface.
Methods
Section titled “Methods”group()
Section titled “group()”group(options?): SceneNode;Create a grouping node.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
SceneNodeOptions |
Returns
Section titled “Returns”path()
Section titled “path()”path(options): SceneNode;Create a freeform path node.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
PathOptions |
Returns
Section titled “Returns”ellipse()
Section titled “ellipse()”ellipse(options): SceneNode;Create an ellipse node.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
EllipseOptions |
Returns
Section titled “Returns”hemisphere()
Section titled “hemisphere()”hemisphere(options): SceneNode;Create a hemisphere node.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
HemisphereOptions |
Returns
Section titled “Returns”cylinder()
Section titled “cylinder()”cylinder(options): SceneNode;Create a cylinder node.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
CylinderOptions |
Returns
Section titled “Returns”MotionSpectype alias
Section titled “MotionSpec”type MotionSpec = object;A named motion applied while presenting a Sprite.
Properties
Section titled “Properties”target
Section titled “target”readonly target: string;Name of the scene node targeted by the motion.
translate?
Section titled “translate?”readonly optional translate?: Transform;Authored translation change.
rotate?
Section titled “rotate?”readonly optional rotate?: Transform;Authored rotation change.
durationMs?
Section titled “durationMs?”readonly optional durationMs?: number;Duration of one motion pass in milliseconds.
repeat?
Section titled “repeat?”readonly optional repeat?: "none" | "loop" | "yoyo";Repetition mode for the motion.
StandardActivitytype alias
Section titled “StandardActivity”type StandardActivity = "idle" | "listening" | "processing" | "speaking" | "thinking" | "error";The standard presentation activity names accepted by every Sprite.
StateGeometrytype alias
Section titled “StateGeometry”type StateGeometry = object;Variant selections applied to one expression or activity.
Properties
Section titled “Properties”expression?
Section titled “expression?”readonly optional expression?: string;Expression selected by an activity.
readonly optional eyes?: string;Value selected from the eyes variant channel.
mouth?
Section titled “mouth?”readonly optional mouth?: string;Value selected from the mouth variant channel.
blush?
Section titled “blush?”readonly optional blush?: number;Normalized blush intensity.
MouthCycleSteptype alias
Section titled “MouthCycleStep”type MouthCycleStep = object;One timed mouth state in a speaking cycle.
Properties
Section titled “Properties”durationMs
Section titled “durationMs”readonly durationMs: number;Time spent in this mouth state, in milliseconds.
readonly mouth: "base" | "open";Mouth state shown during the step.
ActivitySpectype alias
Section titled “ActivitySpec”type ActivitySpec = object;Presentation behavior associated with an activity.
Properties
Section titled “Properties”motion?
Section titled “motion?”readonly optional motion?: MotionSpec;Optional motion authored for the activity.
geometry?
Section titled “geometry?”readonly optional geometry?: StateGeometry;Optional geometry selections authored for the activity.
mouseInfluence?
Section titled “mouseInfluence?”readonly optional mouseInfluence?: number;Authored pointer-influence strength.
mouthCycle?
Section titled “mouthCycle?”readonly optional mouthCycle?: readonly MouthCycleStep[];Ordered timed mouth states for the activity.
ExpressionSpectype alias
Section titled “ExpressionSpec”type ExpressionSpec = object;Variant and motion behavior associated with an expression.
Properties
Section titled “Properties”variants?
Section titled “variants?”readonly optional variants?: Record<string, string>;Fixed value selected for each variant channel.
variantChoices?
Section titled “variantChoices?”readonly optional variantChoices?: Record<string, readonly string[]>;Candidate values authored for each variant channel.
blush?
Section titled “blush?”readonly optional blush?: number;Normalized blush intensity.
motion?
Section titled “motion?”readonly optional motion?: MotionSpec;Optional motion authored for the expression.
BuildResulttype alias
Section titled “BuildResult”type BuildResult = object;The root and named variants produced by one author build.
Properties
Section titled “Properties”readonly root: SceneNode;Root node of the rendered scene tree.
variants?
Section titled “variants?”readonly optional variants?: Record<string, Record<string, SceneNode>>;Definition-local nodes grouped by variant channel and value.
AuthorContexttype alias
Section titled “AuthorContext”type AuthorContext = object;Renderer-neutral capabilities available while authoring a Sprite.
Properties
Section titled “Properties”readonly scene: SceneBuilder;Scene builder valid only for the duration of build.
readonly color: (name) => string;Create an opaque reference to an own palette slot.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
Returns
Section titled “Returns”string
SpriteDefinitionInputtype alias
Section titled “SpriteDefinitionInput”type SpriteDefinitionInput = object;Input accepted by the Sprite authoring seam.
Properties
Section titled “Properties”apiVersion
Section titled “apiVersion”readonly apiVersion: 1;Version of the authoring contract used by this definition.
readonly name: string;Human-readable Sprite definition name.
palette
Section titled “palette”readonly palette: Record<string, string>;Named default paints available to the author callback.
readonly build: (context) => BuildResult;Construct the renderer-neutral scene and its named variants.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context |
AuthorContext |
Returns
Section titled “Returns”expressions
Section titled “expressions”readonly expressions: Record<string, ExpressionSpec>;Named expression specifications; at least one is required.
activities?
Section titled “activities?”readonly optional activities?: Record<string, ActivitySpec>;Optional custom activity specifications.
defaultPresentation?
Section titled “defaultPresentation?”readonly optional defaultPresentation?: object;Initial activity and expression selected when mounted.
activity?
Section titled “activity?”readonly optional activity?: string;Standard or custom activity selected initially.
expression?
Section titled “expression?”readonly optional expression?: string;Declared expression selected initially.
SpriteDefinitiontype alias
Section titled “SpriteDefinition”type SpriteDefinition<Input> = Readonly<Input>;An authored Sprite definition preserving the author’s input shape.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
Input extends SpriteDefinitionInput |
SpriteDefinitionInput |
SpriteCheckResulttype alias
Section titled “SpriteCheckResult”type SpriteCheckResult = object;A compact receipt describing one already-authored Sprite definition.
Properties
Section titled “Properties”readonly valid: true;Whether the definition has completed author-time validation.
readonly name: string;Human-readable name of the checked definition.
nodeCount
Section titled “nodeCount”readonly nodeCount: number;Number of scene nodes reachable from the definition root.
expressions
Section titled “expressions”readonly expressions: readonly string[];Expression names in author insertion order.
activities
Section titled “activities”readonly activities: readonly string[];Standard activities followed by unique custom activities in author order.
variants
Section titled “variants”readonly variants: Readonly<Record<string, readonly string[]>>;Variant values by channel, preserving author insertion order.
STANDARD_ACTIVITIESconstant
Section titled “STANDARD_ACTIVITIES”const STANDARD_ACTIVITIES: readonly [ "idle", "listening", "processing", "speaking", "thinking", "error",];The standard presentation activities every Sprite understands.
defineSprite()function
Section titled “defineSprite()”function defineSprite<Input>(input): SpriteDefinition<Input>;Validate and freeze one renderer-neutral Sprite definition.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
Input extends SpriteDefinitionInput |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
Input |
Returns
Section titled “Returns”SpriteDefinition<Input>
check()function
Section titled “check()”function check(definition): SpriteCheckResult;Return a compact, machine-readable receipt for an already authored definition.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
definition |
SpriteDefinition |
Returns
Section titled “Returns”References
Section titled “References”toCharacter
Section titled “toCharacter”Re-exports toCharacter