Monitors a numerical value and exposes functionality for performing mathematical operations with the given signal.
This module exposes no properties.
Method | Description |
---|---|
abs | abs(): ScalarSignal Returns a signal with the value that is the absolute value of the given signal. See Also: ReactiveModule.abs |
add | add(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the sum of the values of the given signals. Note: add and sum functions are synonyms, the behavior they provide is equivalent.See Also: ReactiveModule.sum , ScalarSignal.add , PointSignal.add , VectorSignal.add |
atan2 | atan2(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the angle in radians between the x-axis and the ray from (0, 0) to (x, y) where x and y are the values of the specified signals. The range is -PI to +PI. See Also: ScalarSignal.atan2 |
ceil | ceil(): ScalarSignal Returns a signal with the value that is the smallest integer that is greater than or equal to the value of the given signal. See Also: ScalarSignal.ceil |
clamp | clamp(min: ScalarSignal, max: ScalarSignal): ScalarSignal Returns a signal with the value that is the value of the given x signal constrained to lie between the values of the given min and max signals.Note: The behavior is undefined if min is greater than max . |
cross | cross(other: VectorSignal): PointSignal Returns a vector signal with the value that is the cross product of the given signals. See Also: VectorSignal.dot , ScalarSignal.mul , VectorSignal.mul |
delayBy | delayBy(timeSpan: {milliseconds: number}): ScalarSignal Delays a signal. The argument is an object with a "milliseconds" property specifying the delay duration in milliseconds. |
distance | distance(other: PointSignal): ScalarSignal Returns the distance from the point to another point as a ScalarSignal . |
div | div(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the value of the first signal divided by the value of the second signal. See Also: ScalarSignal.div |
dot | dot(other: VectorSignal): ScalarSignal Returns a scalar signal with the value that is the dot product of the given signals. See Also: VectorSignal.cross , ScalarSignal.mul , VectorSignal.mul |
eq | eq(other: ScalarSignal | number): BoolSignal Compares whether the signal's value is equal to the value of the ScalarSignal passed in the argument and returns the result as a BoolSignal .If the value is equal to the value of other then true is returned. If the value is greater or lower than the value of other then false is returned.The Reactive.eq() method provides equivalent functionality.* other - the ScalarSignal or number to compare against. |
expSmooth | expSmooth(dampFactor: number): ScalarSignal Smooths the specified variable signal using exponential averaging over time and returns the result as a signal of the same type. The Reactive.expSmooth() method provides equivalent functionality.* dampFactor - the dampening time constant, in milliseconds. |
floor | floor(): ScalarSignal Returns a signal with the value that is the largest integer that is less than or equal to the value of the given signal. See Also: ScalarSignal.floor |
format | format(formatString: string): StringSignal Converts the value of the signal to a string and returns the result as a StringSignal .// Load in the required module * formatString - the type of formatting to apply to the string. Use the Folly formatting rules described here to configure the format. |
fromRange | fromRange(min: ScalarSignal, max: ScalarSignal): ScalarSignal Maps x from [min, max] range to [0.0, 1.0] range. |
ge | ge(other: ScalarSignal | number): BoolSignal Compares whether the signal's value is greater than or equal to the value of the ScalarSignal passed in the argument and returns the result as a BoolSignal .If the value is greater than or equal to the value of other then true is returned. If the value is lower than the value of other then false is returned.The Reactive.ge() method provides equivalent functionality.* other - the ScalarSignal or number to compare against. |
gt | gt(other: ScalarSignal | number): BoolSignal Compares whether the signal's value is greater than the value of the ScalarSignal passed in the argument and returns the result as a BoolSignal .If the value is greater than the value of other then true is returned. If the value is lower than the value of other , or if the values are equal, false is returned.The Reactive.gt() method provides equivalent functionality.* other - the ScalarSignal or number to compare against. |
history | history(framesCount: number, initialValues?: Array<number>): SignalHistory<number> Returns a SignalHistory object containing the values of the signal from past frames.Historical signal values are initialized with the signal's value at the time the method was called, or with initialValues if provided.* framesCount - the number of previous frames to track.* initialValues - optional initial values for the signal. |
interval | interval(threshold: number): EventSource<number> Returns an EventSource that emits an event whenever the signal increases to a value greater than or equal to N * threshold , where N is a value that starts at 1 and increases by 1 sequentially.For every N * threshold instance the event is only emitted once. If the scalar signal decreases and subsequently increases again to a previous N * threshold value no event is emitted. As such, the method is best used with positive scalar values that increase progressively.The argument passed to the callback function for the event contains the N * threshold value.//============================================================================ * threshold - the value of the signal at which the event will be emitted at each N occurence. threshold must be a positive number. |
le | le(other: ScalarSignal | number): BoolSignal Compares whether the signal's value is less than or equal to the value of the ScalarSignal passed in the argument and returns the result as a BoolSignal .If the value is lower than or equal to the value of other then true is returned. If the value is greater than the value of other then false is returned.The Reactive.le() method provides equivalent functionality.* other - the ScalarSignal or number to compare against. |
lt | lt(other: ScalarSignal | number): BoolSignal Compares whether the signal's value is less than the value of the ScalarSignal passed in the argument and returns the result as a BoolSignal .If the value is lower than the value of other then true is returned. If the value is greater than the value of other , or if the values are equal, false is returned.The Reactive.lt() method provides equivalent functionality.* other - the ScalarSignal or number to compare against. |
magnitude | magnitude(): ScalarSignal Returns the magnitude of the vector as a ScalarSignal . |
magnitudeSquared | magnitudeSquared(): ScalarSignal Returns the squared length (magnitude) of a given signal. Calculating the squared magnitude instead of the magnitude is much faster. Often if you are comparing magnitudes of two vectors you can just compare their squared magnitudes. |
max | max(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the greater of the values of the given signals. |
min | min(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the lesser of the values of the given signals. |
mix | mix(signal: ScalarSignal, factor: ScalarSignal): ScalarSignal Returns a signal with the value that is the linear interpolation between this and another signal by a given factor. |
mod | mod(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the floating-point remainder of the division of the value of the first signal by the value of the second signal. See Also: ScalarSignal.mod |
monitor | monitor(config?: {fireOnInitialValue?: false | true}): EventSource<{newValue: number, oldValue: number}> Returns an EventSource that emits an event whenever the value of the ScalarSignal changes.The event contains a JSON object which provides the old and new values of the signal in the format { "oldValue": number, "newValue": number } .// Load in the required modules * config - an optional configuration for the event source.The config JSON object can have the following field:** fireOnInitialValue ** - specifies whether an initial event should be emitted containing the signal's initial value. If no value is specified, false is used by default. If set to true , an initial event will be emitted but oldValue will not be available for the first instance. |
mul | mul(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the product of the values of the given signals. See Also: ScalarSignal.mul , VectorSignal.mul |
multiTrigger | multiTrigger(threshold: number): EventSource<number> Returns an EventSource that emits an event every time the ScalarSignal increases to a value greater than or equal to threshold .The argument passed to the callback function for the event contains the threshold value.// Load in the required modules * threshold - the value of the signal at which the event will be emitted. |
ne | ne(other: ScalarSignal | number): BoolSignal Compares whether the signal's value is not equal to the value of the ScalarSignal passed in the argument and returns the result as a BoolSignal .If the value is not equal to the value of other then true is returned. If the values are equal then false is returned.The Reactive.ne() method provides equivalent functionality.* other - the ScalarSignal or number to compare against. |
neg | neg(): ScalarSignal Returns a signal with the negated value of the given signal. See Also: ScalarSignal.neg , VectorSignal.neg |
normalize | normalize(): VectorSignal Returns the normalized (unit) vector in the direction of the original vector as a VectorSignal . |
pin | pin(): ScalarSignal Returns a new ScalarSignal with a constant value, which is equal to the value that the original signal contained immediately after the method was called. |
pinLastValue | pinLastValue(): ConstScalarSignal Returns a ConstScalarSignal with a constant value, which is equal to the value that the original signal contained immediately before the method was called.Unlike ScalarSignal objects, ConstScalarSignal objects can be passed as an argument to methods that expect a primitive number type. |
pow | pow(exponent: ScalarSignal): ScalarSignal Returns a signal with the value that is the base signal raised to the power of the exponent signal. The result is undefined if the base is negative, or if the base is zero and the exponent is not positive. See Also: ScalarSignal.pow |
reflect | reflect(normal: VectorSignal): VectorSignal Calculates the reflection direction for an incident vector and a normal as a VectorSignal . |
round | round(): ScalarSignal Returns a signal with the value that is the rounded value of the given signal. Note: When the fractional part is 0.5, it rounds the number away from zero, which is at odds with JavaScript standard behavior of rounding it always up in such cases. Therefore, this function is NOT exactly the reactive counterpart of the standard JavaScript Math.round utility.See Also: ScalarSignal.round |
schmittTrigger | schmittTrigger(config: {high: number, initialValue?: false | true, low: number}): BoolSignal Returns a BoolSignal with true if the signal is higher than the upper threshold specified, or false if the signal is lower than the lower threshold specified.If the signal contains a value within, or equal to, the threshold values this method returns the same boolean value it contained in the previous update, or the value specified by initialValue if this is the first update.// Load in the required module * config - the configuration for the threshold values.The config JSON object can have the following fields:** low ** - the lower threshold. If the signal is lower than this, the method returns false .** high ** - the upper threshold. If the signal is higher than this, the method returns true .** initialValue ** - an optional initial value for the boolean returned by the method. If no value is specified, this is set to false by default. |
sign | sign(): ScalarSignal Returns a signal with the value that is the sign of the given signal. Possible sign values: NaN, -0.0, 0.0, -1.0, 1.0. Note: this function is the reactive counterpart of the standard JavaScript Math.sign utility.See Also: ScalarSignal.sign |
smoothStep | smoothStep(edge0: ScalarSignal, edge1: ScalarSignal): ScalarSignal Returns 0.0 if x is less than edge0, and 1.0 if x is greater than edge1. If x is between edge0 and edge1, smooth Hermite interpolation is performed. |
sqrt | sqrt(): ScalarSignal Returns a signal with the value that is the square root of the value of the given signal. See Also: ScalarSignal.sqrt |
sub | sub(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the difference of the values of the given signals. See Also: ScalarSignal.sub , VectorSignal.sub , PointSignal.sub |
sum | sum(other: ScalarSignal): ScalarSignal Returns a signal with the value that is the sum of the values of the given signals. Note: add and sum functions are synonyms, the behavior they provide is equivalent.See Also: ReactiveModule.sum , ScalarSignal.add , PointSignal.add , VectorSignal.add |
toRange | toRange(min: ScalarSignal, max: ScalarSignal): ScalarSignal Maps x from [0.0, 1.0] range to [min, max] range. |
toString | toString(): StringSignal Converts a ScalarSignal to a StringSignal according to the default string formatting rules.Note: ScalarSignal.format allows more flexible control over the way the number is converted to string. |
trigger | trigger(threshold: number): EventSource<number> Returns an EventSource that emits an event the first time the ScalarSignal increases to a value greater than or equal to threshold .Only a single event is ever emitted by the returned EventSource .The argument passed to the callback function for the event contains the threshold value.Calling this method with a positive threshold value is equivalent to calling EventSource.interval(threshold).take(1) .// Load in the required modules * threshold - the value of the signal at which the event will be emitted. |