Skip to main content

decorators

import {...} from "@motion-canvas/2d/lib/decorators";

Classes

Interfaces

Type Aliases

CanvasStyleSignal

Type Parameters


FiltersSignal

type FiltersSignalTOwner = SignalFilter[]Filter[]TOwnerFiltersSignalContextTOwner[K in FilterName]: SimpleSignalnumberTOwner

Type Parameters


Initializer

type InitializerT = instance: Tcontext?: any => void

Type Parameters


Vector2LengthSignal

Type Parameters

Functions

addInitializer

public addInitializerTtarget: anyinitializer: InitializerT: void

Type Parameters

Parameters


canvasStyleSignal

public canvasStyleSignal(): PropertyDecorator

cloneable

public cloneableTvalue: boolean = true: PropertyDecorator

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 = true

    Whether the property should be cloneable.


colorSignal

public colorSignal(): PropertyDecorator

compound

public compoundentries: Recordstringstring: PropertyDecorator

Create a compound property decorator.

This decorator turns a given property into a signal consisting of one or more nested signals.

Examples

Parameters

  • entries: Recordstringstring

    A record mapping the property in the compound object to the corresponding property on the owner node.


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

public defaultStyleTstyleName: stringparse: value: string => T = ...: PropertyDecorator

Type Parameters

Parameters


filtersSignal

public filtersSignal(): PropertyDecorator

getPropertiesOf

public getPropertiesOfvalue: any: RecordstringPropertyMetadataany

Parameters


getPropertyMeta

public getPropertyMetaTobject: anykey: stringsymbol: PropertyMetadataTnull

Type Parameters

Parameters


getPropertyMetaOrCreate

public getPropertyMetaOrCreateTobject: anykey: stringsymbol: PropertyMetadataT

Type Parameters

Parameters


initial

public initialTvalue: T: PropertyDecorator

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

  • value: T

    The initial value of the property.


initialize

public initializetarget: anycontext?: any: void

Parameters


initializeSignals

public initializeSignalsinstance: anyprops: Recordstringany: void

Parameters


inspectable

public inspectableTvalue: boolean = true: PropertyDecorator

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 = true

    Whether 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


parser

public parserTvalue: value: any => T: PropertyDecorator

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

  • value: value: any => T

    The wrapper class for the property.


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