@revideo/2d / decorators / compound
Function: compound()
compound(
entries):PropertyDecorator
Defined in: 2d/src/lib/decorators/compound.ts:37
Create a compound property decorator.
Parameters
entries
Record<string, string>
A record mapping the property in the compound object to the corresponding property on the owner node.
Returns
PropertyDecorator
Remarks
This decorator turns a given property into a signal consisting of one or more nested signals.
Example
class Example {
\@compound({x: 'scaleX', y: 'scaleY'})
public declare readonly scale: Signal<Vector2, this>;
public setScale() {
this.scale({x: 7, y: 3});
// same as:
this.scale.x(7).scale.y(3);
}
}