new ONumber(value)
Creates an ONumber object representing the value argument.
It is highly recommended to use the static factory instead as it is optimised to
avoid creating unnecessary instances.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number |
Members
-
<static> Accumulator
-
- Deprecated:
-
- Use
accumulatorinstead
- Use
-
<static> Animate
-
- Deprecated:
-
- Use
animateinstead
- Use
-
<static> AnimateFullDefinition
-
- Deprecated:
-
- Use
animateFullDefinitioninstead
- Use
-
<static> Cap
-
- Deprecated:
-
- Use
capinstead
- Use
-
<static> Derivate
-
- Deprecated:
-
- Use
derivativeinstead
- Use
-
<static> derivate
-
- Deprecated:
-
- Use
derivativeinstead
- Use
-
<static> Diff
-
- Deprecated:
-
- Use
diffinstead
- Use
-
<static> Div
-
- Deprecated:
-
- Use olympe.df.ONumber.div instead
-
<static> EASING :function
-
Type:
- function
Properties:
Name Type Default Description LinearTweenfunction simple linear tweening - no easing, no acceleration
EaseInQuadfunction EaseInQuad EaseOutQuadfunction EaseInOutQuadfunction EaseInCubicfunction EaseOutCubicfunction EaseInOutCubicfunction EaseInQuartfunction EaseOutQuartfunction EaseInOutQuartfunction EaseInQuintfunction EaseOutQuintfunction EaseInOutQuintfunction EaseInSinefunction EaseOutSinefunction EaseInOutSinefunction EaseInExpofunction EaseOutExpofunction EaseInOutExpofunction EaseInCircfunction EaseOutCircfunction EaseInOutCircfunction EaseBackInCubicfunction EaseBackInQuarticfunction EaseBackOutCubicfunction EaseBackOutQuarticfunction EaseOutElasticSmallfunction EaseOutElasticBigfunction EaseInElasticSmallfunction EaseInElasticBigfunction EaseOutBouncefunction EaseInBouncefunction -
<static, constant, non-null> INFINITY :olympe.df.ONumber
-
The number Infinity.
Type:
-
<static> Integrate
-
- Deprecated:
-
- Use
integrateinstead
- Use
-
<static> Minus
-
- Deprecated:
-
- Use olympe.df.ONumber.minus instead
-
<static, constant, non-null> MINUSINFINITY :olympe.df.ONumber
-
The number -Infinity.
Type:
-
<static, constant, non-null> NAN :olympe.df.ONumber
-
The 'Not a Number' constant.
Type:
-
<static> Offset
-
- Deprecated:
-
- Use
offsetinstead
- Use
-
<static, constant, non-null> ONE :olympe.df.ONumber
-
The number 1.
Type:
-
<static, constant, non-null> PI :olympe.df.ONumber
-
The number PI.
Type:
-
<static> Plus
-
- Deprecated:
-
- Use olympe.df.ONumber.plus instead
-
<static> PlusEqual
-
- Deprecated:
-
- Use
plusEqualinstead
- Use
-
<static> ToggleSign
-
- Deprecated:
-
- Use olympe.df.ONumber.toggleSign instead
-
<static> ToOString
-
- Deprecated:
-
- Use olympe.df.ONumber.toOString instead
-
<static, constant, non-null> TWO :olympe.df.ONumber
-
The number 2.
Type:
-
<static, constant, non-null> ZERO :olympe.df.ONumber
-
The number 0.
Type:
Methods
-
<static> accumulator(onu [, min] [, max], easingFunction)
-
Parameters:
Name Type Argument Description onuolympe.df.PONumber | number minolympe.df.PONumber | number <optional>
maxolympe.df.PONumber | number <optional>
easingFunctionfunction easing function to use when min or max change value
Returns:
- Type
- olympe.df.PONumber
-
<static> animate(value, duration [, animationFunction] [, onDone])
-
Transforms a numerical data-flow into another one where the changes in the initial data-flow are 'animated' over the specified duration.
Compute the animation with requestAnimationFrame A new duration value is not taken into account if there is an animation running
Parameters:
Name Type Argument Description valueolympe.df.PONumber | number The initial data-flow.
durationolympe.df.PONumber | number The duration in milliseconds.
animationFunctionfunction <optional>
animation function takes as first parameter a number between 0 and 1 (time) and returns a number (the position)
onDoneolympe.df.ONumber.AnimateCallback <optional>
function to be called when animation is finished
Returns:
The resulting data-flow.
- Type
- olympe.df.PONumber
-
<static> animateFullDefinition(myOnu, duration, myFunc)
-
Compute the animation without requestAnimationFrame
Parameters:
Name Type Description myOnuolympe.df.PONumber durationolympe.df.PONumber | number myFuncfunction animation function takes as first parameter a number between 0 and 1 (time) and returns a number (the position)
Returns:
- Type
- olympe.df.PONumber
-
<static> animateOnce(start, end, duration [, animationFunction] [, onDone] [, flow])
-
Creates a numerical data-flow where the value will change over the specified duration from the initial value to the specified end value.
Parameters:
Name Type Argument Default Description startolympe.df.ONumber | number Starting value.
endolympe.df.ONumber | number End value.
durationnumber 1000 Duration, in milliseconds, for the transition.
animationFunctionfunction <optional>
The function to calculate each incremental step. Default is
LinearTween.onDoneolympe.df.ONumber.AnimateCallback <optional>
Function that will be called at the end of the animation.
flowolympe.df.FlowSource.<!olympe.df.ONumber> <optional>
The
FlowSourceto update. A new one will be create if omitted.Returns:
The resulting data-flow.
- Type
- olympe.df.PONumber
-
<static> cap(myOnu, min, max)
-
Returns the input value (myOnu) if within [min, max] range Returns min if myOnu smaller than min Returns max if myOnu bigger than max
Parameters:
Name Type Description myOnuolympe.df.PONumber | number minolympe.df.PONumber | number maxolympe.df.PONumber | number Returns:
- Type
- olympe.df.PONumber
-
<static> derivative(myOnu)
-
Returns the ratio of the difference between last value and current value over the time elapsed during the change in value
Parameters:
Name Type Description myOnuolympe.df.Proxy.<olympe.df.ONumber> Returns:
- Type
- olympe.df.PONumber
-
<static> diff(myOnu)
-
Returns the difference between last value and current value
Parameters:
Name Type Description myOnuolympe.df.Proxy.<olympe.df.ONumber> Returns:
- Type
- olympe.df.PONumber
-
<static> div(oNum1, oNum2)
-
Divides 2 numbers and returns the result.
Parameters:
Name Type Description oNum1olympe.df.PONumber | number the dividend
oNum2olympe.df.PONumber | number the divisor
Returns:
the result of oNum1 / oNum2
- Type
- olympe.df.PONumber
-
<static> fromJSON(json)
-
Deserializes an
ONumberfrom a JSON object or string.Parameters:
Name Type Description jsonstring | Object Returns:
- Type
- olympe.df.ONumber
-
<static> hexToONumber(hex)
-
Converts an hexadecimal string into a
ONumber.Parameters:
Name Type Description hexolympe.df.POString Returns:
the converted
ONumber- Type
- olympe.df.PONumber
-
<static> integrate(myOnu)
-
Returns the integral of the value function of the time in milli seconds
Parameters:
Name Type Description myOnuolympe.df.Proxy.<olympe.df.ONumber> Returns:
- Type
- olympe.df.PONumber
-
<static> max(oNumbers)
-
Returns the ONumber with the highest value.
Please note that this method only accepts enumerable of proxy to ONumber.
Parameters:
Name Type Description oNumbersolympe.df.Enumerable.<olympe.df.PONumber> Returns:
the ONumber with the highest value
- Type
- olympe.df.PONumber
-
<static> maxF(oNumbers)
-
Returns the ONumber with the highest value.
Parameters:
Name Type Argument Description oNumbersolympe.df.PONumber | number <repeatable>
a set of numbers
Returns:
the ONumber with the highest value.
- Type
- olympe.df.PONumber
-
<static> minF(oNumbers)
-
Returns the ONumber with the smallest value.
Parameters:
Name Type Argument Description oNumbersolympe.df.PONumber | number <repeatable>
a set of numbers
Returns:
the ONumber with the smallest value
- Type
- olympe.df.PONumber
-
<static> minus(oNum1, oNum2)
-
Subtracts 2 numbers and return the result.
Parameters:
Name Type Description oNum1olympe.df.PONumber | number oNum2olympe.df.PONumber | number Returns:
the result of oNum1 - oNum2
- Type
- olympe.df.PONumber
-
<static> offset(myOnu)
-
Returns the diff between initial call and current value
Parameters:
Name Type Description myOnuolympe.df.PONumber Returns:
- Type
- olympe.df.PONumber
-
<static> plus(oNum1, oNum2)
-
Adds 2 numbers and returns the result.
Parameters:
Name Type Description oNum1olympe.df.PONumber | number oNum2olympe.df.PONumber | number Returns:
the result of oNum1 + oNum2
- Type
- olympe.df.PONumber
-
<static> plusEqual(thisONum [, valueToAdd])
-
Adds a value to the specified
ONumber.Parameters:
Name Type Argument Description thisONumolympe.df.Proxy.<olympe.df.ONumber> the Proxy of
ONumberto add the value tovalueToAddolympe.df.PONumber | number <optional>
the value to add to the
ONumberReturns:
the Proxy of
ONumberpassed as argument- Type
- olympe.df.PONumber
-
<static> toggleSign(number)
-
Toggles the sign (invert) of a number. e.g. 1 -> -1.
Parameters:
Name Type Description numberolympe.df.PONumber | number to invert
Returns:
the result of the inversion
- Type
- olympe.df.PONumber
-
<static> toOString(number)
-
Converts a number into a
OString.Parameters:
Name Type Description numberolympe.df.PONumber | number Returns:
- Type
- olympe.df.POString
-
abs()
-
Returns the absolute value of this number.
Returns:
the absolute value for this ONumber`
- Type
- olympe.df.PONumber
-
atan2(y)
-
Calculates the angle in the plane (in radians) between the positive x-axis and the ray from (0,0) to the point (x, y) where x is this
ONumberandyis the parameter.Parameters:
Name Type Description yolympe.df.PONumber | number the y coordinate for the point.
Returns:
The angle in radians (in [-\pi, \pi])
- Type
- olympe.df.PONumber
-
ceil()
-
Rounds this
ONumberto its closest higher integer.Returns:
the result of the rounding
- Type
- olympe.df.PONumber
-
cos()
-
Calculate the cosine of an angle given in radians. Returns a numeric value between -1 and 1.
var n = olympe.df.oNumber(0).cos(); // 1 n = olympe.df.oNumber(1).cos(); // 0.5403023058681398Returns:
the cosine of this number.
- Type
- olympe.df.PONumber
-
div(divBy)
-
Divides this
ONumberwith a value and return the result in a new instance.Parameters:
Name Type Description divByolympe.df.PONumber | number the value to divide this
ONumberbyReturns:
the result of the division
- Type
- olympe.df.PONumber
-
equals( [otherONum])
-
Checks whether the value of this
ONumberis equal to another number.Parameters:
Name Type Argument Description otherONumolympe.df.ONumber | number <optional>
Returns:
true if both numbers are equals, false otherwise
- Type
- boolean
-
exp()
-
Calculates E to the power of this
ONumberand returns the result in a new instance.Returns:
the value of E to the power of this number.
- Type
- olympe.df.PONumber
-
floor()
-
Rounds this
ONumberto its closest lower integer.Returns:
the result of the rounding
- Type
- olympe.df.PONumber
-
getNumber()
-
- Deprecated:
-
- Use
valueOfif you need the primitive type.
- Use
Returns:
- Type
- number
-
isBiggerThan(otherONumber)
-
Checks whether an
ONumberis bigger than an other number.Parameters:
Name Type Description otherONumberolympe.df.PONumber | number The value to compare with
Returns:
true if the value of this
ONumberis bigger than the value of the parameter- Type
- olympe.df.POBoolean
-
isNaN()
-
Checks whether this ONumber represents a valid number.
Returns:
true is this is not a valid number.
- Type
- olympe.df.POBoolean
-
isSmallerThan(otherONumber)
-
Checks whether an
ONumberis smaller than an other number.Parameters:
Name Type Description otherONumberolympe.df.PONumber | number The value to compare with
Returns:
true if the value of this
ONumberis smaller than the value of the parameter- Type
- olympe.df.POBoolean
-
linearInterpolate(y, ratio)
-
Calculates the point on the linear interpolate line between this number and the parameter. Formula is: (x * ratio) + (y * (1 - ratio)) where
xis this number andyis the parameter.Parameters:
Name Type Description yolympe.df.PONumber | number ratioolympe.df.PONumber | number 0..1 (a value of 0 means return y, a value of 1 means return this oNum)
Returns:
- Type
- olympe.df.PONumber
-
log()
-
Returns the natural logarithm (base E) of this
ONumberReturns:
the natural logarithm of this
ONumber- Type
- olympe.df.PONumber
-
minus(valueToSubtract)
-
Subtracts a value from this
ONumberand returns the result in a new instance.Parameters:
Name Type Description valueToSubtractolympe.df.PONumber | number the value to subtract from this
ONumberReturns:
the result of the subtraction
- Type
- olympe.df.PONumber
-
mod(divisor)
-
Calculates the remainder after division of this
ONumberby the specified value.Parameters:
Name Type Description divisorolympe.df.PONumber | number the value to use as the divisor
Returns:
the result of the modulo operation
- Type
- olympe.df.PONumber
-
mul(valueToMul)
-
Multiplies this
ONumberwith a value and return the result in a new instance.Parameters:
Name Type Description valueToMulolympe.df.PONumber | number the value to multiply this
ONumberwithReturns:
the result of the multiplication
- Type
- olympe.df.PONumber
-
oEquals(otherONum)
-
Checks whether this
ONumberis equal to another number.Parameters:
Name Type Description otherONumolympe.df.PONumber | number the value to compare to
Returns:
true if both numbers are equals, false otherwise
- Type
- olympe.df.POBoolean
-
plus(valueToAdd)
-
Adds a value to this
ONumberand return the result in a new instance.Parameters:
Name Type Description valueToAddolympe.df.PONumber | number the value to add to this
ONumberReturns:
the result of the addition
- Type
- olympe.df.PONumber
-
pow(power)
-
Calculates the value of this
ONumberto the power of the specified value.Parameters:
Name Type Description powerolympe.df.PONumber | number the exponent
Returns:
- Type
- olympe.df.PONumber
-
returnsBiggest(otherOnum)
-
Gets the highest value of two numbers.
Parameters:
Name Type Description otherOnumolympe.df.PONumber | number The value to compare with
Returns:
An
ONumbercontaining the highest of the 2 values- Type
- olympe.df.PONumber
-
returnsSmallest(otherOnum)
-
Gets the smallest value of two numbers.
Parameters:
Name Type Description otherOnumolympe.df.PONumber | number The value to compare with
Returns:
An
ONumbercontaining the smallest of the 2 values- Type
- olympe.df.PONumber
-
round()
-
Rounds this
ONumberand returns the result in a new instance.Returns:
the result of the rounding
- Type
- olympe.df.PONumber
-
sin()
-
Calculate the sine of an angle given in radians. Returns a numeric value between -1 and 1.
var n = olympe.df.oNumber(0).sin(); // 0 n = olympe.df.oNumber(1).sin(); // 0.8414709848078965Returns:
the sine of this number.
- Type
- olympe.df.PONumber
-
toFixed(fixed)
-
Converts this number into a String, keeping only the specified number of decimals. If the number value is not valid, '' is returned.
Parameters:
Name Type Description fixednumber The number of decimals wanted
- See:
-
isNaN
Returns:
- Type
- string
-
toggleSign()
-
Toggles (inverts) the sign of this
ONumberand return the result in a new instance.Returns:
the inverse of this
ONumber- Type
- olympe.df.PONumber
-
toJSON()
-
Converts this
ONumberinto a JSON string.Returns:
- Type
- string
-
toOString()
-
Converts this number into an OString. If the number value is not valid, an empty string is returned.
- See:
Returns:
the string representation of this number.
- Type
- olympe.df.POString
-
toString( [radix] [, decimal])
-
Converts this number into a String. If the number value is not valid, an empty string is returned.
Parameters:
Name Type Argument Description radixnumber <optional>
the base in which to translate the number defaults to 10
decimalnumber <optional>
number of decimals. Defaults is 'all decimals'
Returns:
- Type
- string
-
trunc()
-
Returns the integer part of this
ONumber. e.g. 8.12 truncates to 8.Returns:
the result of this truncation
- Type
- olympe.df.PONumber
-
valueOf()
-
Converts this
ONumberinto the base javascript typenumber.Returns:
the value of this
ONumber- Type
- number
Type Definitions
-
AnimateCallback(animateResult)
-
Parameters:
Name Type Description animateResultnumber
Olympe SDK