@command
Marks a generator method as an editor-facing command, with labels, typed parameter metadata and duration defaults.
class Card extends LayoutActor {
@command({
label: "Reveal",
duration: { default: 0.4 },
})
*reveal() {
yield* this.appearance.opacity.tween(1, 0.4);
}
@command({
label: "Move To",
params: {
x: { kind: "number", label: "X" },
y: { kind: "number", label: "Y" },
},
duration: { default: 0.4 },
})
*moveTo({ x, y }: { x: number; y: number }, duration: number) {
yield* this.runtime.all(
this.layout.x.tween(x, duration),
this.layout.y.tween(y, duration),
);
}
}
The decorator adds reflection metadata only. Methods without it work exactly the same when
called from code — @command is what makes them discoverable from an editor timeline or a
command palette.
Options
PropType
label?string
Human-readable name shown in editor surfaces.
Type
stringparams?Record<string, { kind: string; label: string }>
Per-parameter metadata: kind and label, used to build editor inputs.
Type
Record<string, { kind: string; label: string }>duration?{ default: Duration }
Duration metadata, including the default an editor should offer.
Type
{ default: Duration }Use it for
- Generator methods intended to be invoked from an editor timeline or command palette.
- Commands with meaningful default durations or typed parameters.
Do not use it for
- Business logic — the decorator does not change behaviour.
- Plain data fields. It decorates generator methods.