ReactiveModule


The ReactiveModule class exposes methods for reactive programming.

Properties

This class exposes no properties.

Methods

MethodDescription

HSVA

HSVA(h: ScalarSignal, s: ScalarSignal, v: ScalarSignal, a: ScalarSignal): HsvaSignal

Combines four signals and returns the result as an HsvaSignal. Each value should be in the range between 0.0 and 1.0.

Note: Hue value is also specified in the range between 0.0 and 1.0.

RGBA

RGBA(r: ScalarSignal, g: ScalarSignal, b: ScalarSignal, a: ScalarSignal): RgbaSignal

Combines four signals and returns the result as an RgbaSignal. Each value should be in the range between 0.0 and 1.0.

Note: RGB components are interpreted in sRGB space.

andList

andList(x: Array<BoolSignal>): BoolSignal

Returns a signal with the value that is the logical and of the values in an array

antiderivative

antiderivative(signal: ScalarSignal, {min: number, max: number, initialValue: number, overflowBehaviour: ReactiveModule.AntiderivativeOverflowBehaviour}): ScalarSignal

Returns a signal that estimates the anti derivative of the given signal with respect to time (measured in milliseconds).

Note: Since the antiderivative is inherently unbound the min/max parameters must be provided to prevent overflow. when overflowBehaviour is CLAMP the output is clamped at the min/max. When overflowBehaviour is WRAP the output is wrapped. This is useful when the output represents something that is cyclic like an angle in this case min might be 0, max might be 2*PI.

concat

concat(lhs: StringSignal, rhs: StringSignal): StringSignal

Returns a StringSignal containing the concatenation of the values specified by the input signals.

See Also: StringSignal.concat

derivative

derivative(): ScalarSignal

Returns a signal that estimates the derivative of the given signal with respect to time (measured in milliseconds).

Note: the value of the derivative at the initial point of time is always set to zero.

Note: the returned signal might be noisy for certain types of input signals, especially those received from the face tracking. It is recommended to pass the input signal to expSmooth first with a damping constant in the range between 100 and 500.

eq

eq(lhs: ScalarSignal, rhs: ScalarSignal): BoolSignal eq(lhs: StringSignal, rhs: StringSignal): BoolSignal eq(lhs: BoolSignal, rhs: BoolSignal): BoolSignal

Returns a Boolean signal that takes the value of true every time when the value of the left-hand-side signal is equal to the value of the right-hand-side one, and the value of false all other time.

Note: the scalar values are tested for exact equality. For some applications it might be reasonable to perform a non-strict comparison allowing the values to be within a small distance one from another.

See Also: ScalarSignal.eq, StringSignal.eq, BoolSignal.eq

expSmooth

expSmooth(signal: ScalarSignal, dampFactor: number): ScalarSignal expSmooth(signal: PointSignal, dampFactor: number): PointSignal expSmooth(signal: VectorSignal, dampFactor: number): VectorSignal expSmooth(signal: TransformSignal, dampFactor: number): TransformSignal

Smoothes a variable signal using exponential averaging over time. The argument specifies the dampening time constant in milliseconds.

Note: See also ScalarSignal.expSmooth, PointSignal.expSmooth, VectorSignal.expSmooth, TransformSignal.expSmooth.

Note: The smoothed transformation for a signal that specifies a rigid body transformation is guaranteed to be a rigid body transformation. The rotation component is smoothed in spherical coordinates using Slerp (spherical linear interpolation).

ge

ge(lhs: ScalarSignal, rhs: ScalarSignal): BoolSignal

Returns a Boolean signal that takes the value of true every time when the value of the left-hand-side signal is greater than or equal to the value of the right-hand-side one, and the value of false all other time.

See Also: ScalarSignal.ge

gt

gt(lhs: ScalarSignal, rhs: ScalarSignal): BoolSignal

Returns a Boolean signal that takes the value of true every time when the value of the left-hand-side signal is strictly greater than the value of the right-hand-side one, and the value of false all other time.

See Also: ScalarSignal.gt

le

le(lhs: ScalarSignal, rhs: ScalarSignal): BoolSignal

Returns a Boolean signal that takes the value of true every time when the value of the left-hand-side signal is less than or equal to the value of the right-hand-side one, and the value of false all other time.

See Also: ScalarSignal.le

lt

lt(lhs: ScalarSignal, rhs: ScalarSignal): BoolSignal

Returns a Boolean signal that takes the value of true every time when the value of the left-hand-side signal is strictly less than the value of the right-hand-side one, and the value of false all other time.

See Also: ScalarSignal.lt

monitorMany

monitorMany(signals: { [string]: ScalarSignal}): EventSource monitorMany(signals: { [string]: ScalarSignal}, config: {fireOnInitialValue: ?boolean}): EventSource

Returns an EventSource that emits an event every time when any value of the input signals change. The event contains a JSON object with the old and new values in the format:

{ "oldValues": oldValues, "newValues": newValues }

where oldValues and newValues are the JSON objects where keys are the names of the signals and values are old or new values of that signals correspondingly.

Note: By default, there is no event fired for the initial value of the signal. If config.fireOnInitialValue is set to true then an event for initial signal value is also emitted. oldValues is unset for this initial event.

See Also: ReactiveModule.monitor

mulList

mulList(x: Array<number>): ScalarSignal

Returns a signal with the value that is the product of the values in an array

ne

ne(lhs: ScalarSignal, rhs: ScalarSignal): BoolSignal ne(lhs: StringSignal, rhs: StringSignal): BoolSignal ne(lhs: BoolSignal, rhs: BoolSignal): BoolSignal

Returns a Boolean signal that takes the value of true every time when the value of the left-hand-side signal is not equal to the value of the right-hand-side one, and the value of false all other time.

Note: the scalar values are tested for exact equality. For some applications it might be reasonable to perform a non-strict comparison allowing the values to be within a small distance one from another.

See Also: ScalarSignal.ne, StringSignal.ne, BoolSignal.ne

not

not(signal: BoolSignal): BoolSignal

Returns a signal with the logically negated value of the given signal.

See Also: BoolSignal.not

once

once(): EventSource

Returns an EventSource that emits exactly one empty event as soon as possible.

orList

orList(x: Array<BoolSignal>): BoolSignal

Returns a signal with the value that is the logical or of the values in an array

point

point(x: ScalarSignal, y: ScalarSignal, z: ScalarSignal): PointSignal

Combines three signals and returns the result as a PointSignal.

point2d

point2d(x: ScalarSignal, y: ScalarSignal): PixelPointSignal

Combines two signals and returns the result as a PixelPointSignal.

rotation

rotation(w: number, x: number, y: number, z: number): Rotation

Creates 'Rotation' from quaternion components.

scale

scale(x: ScalarSignal, y: ScalarSignal, z: ScalarSignal): ScaleSignal

Combines three signals and returns the result as a ScaleSignal.

schmittTrigger

schmittTrigger(signal: ScalarSignal, config: { low: number, high: number, initialValue: ?boolean}): BoolSignal

Returns a Boolean signal that is true when the input is strictly greater than the upper threshold, and false when it is strictly less than the lower threshold. For input values between and including the thresholds, the Shmitt trigger returns the same value as at the previous update, or initialValue if this is the first update.

Note: The initialValue is assumed to be false if it isn't specified.

sumList

sumList(x: Array<number>): ScalarSignal

Returns a signal with the value that is the sum of the values in an array

val

val(constant: number): ScalarSignal val(constant: string): StringSignal val(constant: boolean): BoolSignal

Returns a signal that has a constant value which is specified by the argument.

Note: Primitive types are implicitly converted to constant signals when passed as function or property-setter arguments, therefore using val in such scenarios is not required.

vector

vector(x: ScalarSignal, y: ScalarSignal, z: ScalarSignal): VectorSignal

Combines three signals and returns the result as a VectorSignal.

xor

xor(lhs: BoolSignal, rhs: BoolSignal): BoolSignal

Returns a signal with the value that is the logical exclusive disjunction of the values of the given signals. It is true every time exactly one of the input signals is true and false at all other times.

Note: It is equivalent to ReactiveModule.ne.

See Also: BoolSignal.xor

xorList

xorList(x: Array<BoolSignal>): BoolSignal

Returns a signal with the value that is the logical xor of the values in an array

Classes

ClassDescription

BoolSignal

The BoolSignal class monitors a boolean value.

BoolValue

The BoolValue class contains a Boolean value.

BoundingBoxSignal

The BoundingBoxSignal class monitors bounding box values.

ColorSignal

The ColorSignal class monitors a color.

EulerAnglesSignal

The EulerAnglesSignal class monitors Euler angle signal values.

EventSource

The EventSource class provides methods for monitoring signals.

HsvaSignal

The HsvaSignal class monitors a HSVA color value.

ISignal

The ISignal interface. The base class for ScalarSignal, PointSignal, VectorSignal, BooleanSignal, and StringSignal

InsetsSignal

The InsetsSignal class monitors the insets of the effect safe area.

PixelPointSignal

The PixelPointSignal class monitors a 2D coordinate.

PixelSizeSignal

The PixelSizeSignal class monitors the pixel size of the camera info preview.

Point2D

The Point2D class contains a 2D coordinate.

Point2DSignal

The Point2DSignal class monitors a 2D coordinate, in normalized screen space units.

Point3D

The Point3D class contains a 3D coordinate.

Point4DSignal

The Point4DSignal class monitors a 4D coordinate.

PointSignal

The PointSignal class monitors a 3D coordinate.

PrimitiveOrShaderSignal

The PrimitiveOrShader represents a primitive or shader signal.

RgbaSignal

The RgbaSignal class monitors a RGBA color value.

Rotation

The Rotation class encapsulates an object's rotation.

RotationSignal

The RotationSignal class monitors rotation values.

ScalarSignal

The ScalarSignal class monitors a numerical value.

ScalarValue

The ScalarValue class contains a scalar value.

ScaleSignal

The ScalarSignal class monitors an objects scale.

ShaderSignal

The ShaderSignal represents a shader signal.

StringSignal

The StringSignal class monitors a string value.

StringValue

The StringValue class contains a string value.

Subscription

The Subscription class implements object value monitoring.

TransformSignal

The TransformSignal class monitors a scene transform.

VectorSignal

The VectorSignal class monitors a vector.

Enums

ValueDescription

AntiderivativeOverflowBehaviour

The AntiderivativeOverflowBehaviour enum describes the recovery technique used when an antiderivative overflows.