decorators
import {...} from "@motion-canvas/2d/lib/decorators";
Classes​
Interfaces​
Type Aliases​
CanvasStyleSignal​
type CanvasStyleSignalT = SignalPossibleCanvasStyleCanvasStyleT
Type Parameters
FiltersSignal​
type FiltersSignalTOwner = SignalFilter[]Filter[]TOwnerFiltersSignalContextTOwner[K in FilterName]: SimpleSignalnumberTOwner
Type Parameters
Initializer​
Type Parameters
Vector2LengthSignal​
Type Parameters
Functions​
addInitializer​
public addInitializerTtarget: anyinitializer: InitializerT: void
Type Parameters
Parameters
canvasStyleSignal​
public canvasStyleSignal(): PropertyDecorator
cloneable​
Create a cloneable property decorator.
This decorator specifies whether the property should be copied over when cloning the node.
By default, any property is cloneable.
Must be specified before the signal decorator.
Examples
Type Parameters
Parameters
value: boolean = trueWhether the property should be cloneable.
colorSignal​
public colorSignal(): PropertyDecorator
compound​
Create a compound property decorator.
This decorator turns a given property into a signal consisting of one or more nested signals.
Examples
Type Parameters
TSetterValueTValueTKeys extends stringnumbersymbol = keyof TValueTOwner = void
Parameters
entries: RecordstringstringA record mapping the property in the compound object to the corresponding property on the owner node.
klass: Object = CompoundSignalContext
computed​
public computed(): MethodDecorator
Create a computed method decorator.
This decorator turns the given method into a computed value.
See createComputed for more information.
defaultStyle​
Type Parameters
Parameters
filtersSignal​
public filtersSignal(): PropertyDecorator
getPropertiesOf​
public getPropertiesOfvalue: any: RecordstringPropertyMetadataany
Parameters
value: any
getPropertyMeta​
public getPropertyMetaTobject: anykey: stringsymbol: PropertyMetadataTnull
Type Parameters
Parameters
getPropertyMetaOrCreate​
public getPropertyMetaOrCreateTobject: anykey: stringsymbol: PropertyMetadataT
Type Parameters
Parameters
initial​
Create an initial signal value decorator.
This decorator specifies the initial value of a property.
Must be specified before the signal decorator.
Examples
Type Parameters
Parameters
initialize​
Parameters
initializeSignals​
Parameters
inspectable​
Create an inspectable property decorator.
This decorator specifies whether the property should be visible in the inspector.
By default, any property is inspectable.
Must be specified before the signal decorator.
Examples
Type Parameters
Parameters
value: boolean = trueWhether the property should be inspectable.
interpolation​
public interpolationTvalue: InterpolationFunctionTany[]: PropertyDecorator
Create a signal interpolation function decorator.
This decorator specifies the interpolation function of a property. The interpolation function is used when tweening between different values.
Must be specified before the signal decorator.
Examples
Type Parameters
Parameters
value: InterpolationFunctionTany[]The interpolation function for the property.
parser​
Create a signal parser decorator.
This decorator specifies the parser of a property. Instead of returning the raw value, its passed as the first parameter to the parser and the resulting value is returned.
If the wrapper class has a method called lerp it will be set as the
default interpolation function for the property.
Must be specified before the signal decorator.
Examples
Type Parameters
Parameters
signal​
public signalT(): PropertyDecorator
Create a signal decorator.
This decorator turns the given property into a signal.
The class using this decorator can implement the following methods:
get[PropertyName]- A property getter.get[PropertyName]- A property setter.tween[PropertyName]- A tween provider.
Examples
Type Parameters
vector2Signal​
public vector2Signalprefix?: stringRecordstringstring: PropertyDecorator
Parameters
prefix?: stringRecordstringstring
wrapper​
public wrapperTvalue: ()lerp?: InterpolationFunctionTany[]: PropertyDecorator
Create a signal wrapper decorator.
This is a shortcut decorator for setting both the parser and
interpolation.
The interpolation function will be set only if the wrapper class has a method
called lerp, which will be used as said function.
Must be specified before the signal decorator.
Examples
Type Parameters
Parameters
value: ()lerp?: InterpolationFunctionTany[]The wrapper class for the property.