@revideo/2d / decorators / wrapper
Function: wrapper()
wrapper<
T>(value):PropertyDecorator
Defined in: 2d/src/lib/decorators/signal.ts:265
Create a signal wrapper decorator.
Type Parameters
T
T
Parameters
value
(value) => T & { lerp?: InterpolationFunction<T, any[]>; }
The wrapper class for the property.
Returns
PropertyDecorator
Remarks
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.
Example
class Example {
\@wrapper(Vector2)
\@property()
public declare offset: Signal<Vector2, this>;
// same as:
\@parser(value => new Vector2(value))
\@interpolation(Vector2.lerp)
\@property()
public declare offset: Signal<Vector2, this>;
}