Skip to main content

decorators

import {...} from "@wangyaoshen/locus-2d/lib/decorators";

Classes

Interfaces

Type Aliases




Functions

addInitializer

public addInitializertarget: anyinitializer: InitializerT: void

Parameters


canvasStyleSignal

public canvasStyleSignal(): PropertyDecorator

cloneable

public cloneablevalue: 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

Parameters

  • value: boolean = true

    Whether the property should be cloneable.


colorSignal

public colorSignal(): PropertyDecorator

compound

public compoundentries: Recordstringstringklass: typeof CompoundSignalContext = CompoundSignalContext: 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.

  • klass: typeof CompoundSignalContext = 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

public defaultStyleinitial?: T: PropertyDecorator

Parameters


filtersSignal

public filtersSignal(): PropertyDecorator

getPropertiesOf

public getPropertiesOfvalue: any: RecordstringPropertyMetadataany

Parameters


getPropertyMeta

public getPropertyMetaobject: anykey: stringsymbol: nullPropertyMetadataT

Parameters


getPropertyMetaOrCreate

public getPropertyMetaOrCreateobject: anykey: stringsymbol: PropertyMetadataT

Parameters


initial

public initialvalue: 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

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 inspectablevalue: 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

Parameters

  • value: boolean = true

    Whether the property should be inspectable.


interpolation

public interpolationvalue: InterpolationFunctionT: 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

Parameters


parser

public parservalue: 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

Parameters

  • value: value: any => T

    The wrapper class for the property.


signal

public signal(): 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


vector2Signal

public vector2Signalprefix?: stringRecordstringstring: PropertyDecorator

Parameters

  • prefix?: stringRecordstringstring

wrapper

public wrappervalue: ()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

Parameters