Built-In Namespace Number
Method Attributes | Method Name and Description |
---|---|
abs()
<<<<<<< HEAD
=======
Returns the absolute value of this number.
|
|
approach(target, maxDelta)
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
|
|
<<<<<<< HEAD
ceil()
=======
approachByRatio(target, ratio)
|
|
approachRotation(target, maxDelta)
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
|
|
<<<<<<< HEAD
=======
ceil()
Returns the mathematical ceiling of this number.
|
|
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
clamp(min, max)
Returns a number whose value is limited to the given range.
|
|
<<<<<<< HEAD
floor()
=======
constrainRotation()
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
|
|
<<<<<<< HEAD
=======
d(sides)
|
|
floor()
Returns the mathematical floor of this number.
|
|
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
mod(base)
A mod method useful for array wrapping.
|
|
round()
<<<<<<< HEAD
=======
Returns this number rounded to the nearest integer.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
|
|
sign()
<<<<<<< HEAD
=======
Get the sign of this number as an integer (1, -1, or 0).
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
|
|
snap(resolution)
Returns the the nearest grid resolution less than or equal to the number.
|
|
times(iterator, context)
<<<<<<< HEAD
Calls iterator the specified number of times, passing in the number of the
=======
Calls iterator the specified number of times, passing in the number of the
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
current iteration as a parameter: 0 on first call, 1 on the second call, etc.
|
|
Method Detail
<<<<<<< HEAD
=======
{Number}
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
abs()
<<<<<<< HEAD
Defined in: GameLib.js. ======= Returns the absolute value of this number.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Defined in: GameLib.js. ======= Returns the absolute value of this number.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Returns:
- The absolute value of the number.
<<<<<<< HEAD
ceil()
=======
approach(target, maxDelta)
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Parameters:
- target
- maxDelta
approachByRatio(target, ratio)
Defined in: gamelib.js.
- Parameters:
- target
- ratio
approachRotation(target, maxDelta)
Defined in: gamelib.js.
- Parameters:
- target
- maxDelta
{Number}
ceil()
Returns the mathematical ceiling of this number.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Returns:
- The number truncated to the nearest integer of greater than or equal value. (4.9).ceil(); // => 5 (4.2).ceil(); // => 5 (-1.2).ceil(); // => -1
{Number}
clamp(min, max)
Returns a number whose value is limited to the given range.
Example: limit the output of this computation to between 0 and 255
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
(x * 255).clamp(0, 255)
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Parameters:
- {Number} min
- The lower boundary of the output range
- {Number} max
- The upper boundary of the output range
- Returns:
- A number in the range [min, max]
<<<<<<< HEAD
floor()
=======
constrainRotation()
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Returns:
- This number constrained between -PI and PI.
d(sides)
Defined in: gamelib.js.
- Parameters:
- sides
{Number}
floor()
Returns the mathematical floor of this number.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Returns:
- The number truncated to the nearest integer of less than or equal value. (4.9).floor(); // => 4 (4.2).floor(); // => 4 (-1.2).floor(); // => -2
{Number}
mod(base)
A mod method useful for array wrapping. The range of the function is
constrained to remain in bounds of array indices.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Example: (-1).mod(5) === 4
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Parameters:
- {Number} base
- Returns:
- An integer between 0 and (base - 1) if base is positive.
<<<<<<< HEAD
=======
{Number}
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
round()
<<<<<<< HEAD
Defined in: GameLib.js. ======= Returns this number rounded to the nearest integer.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Defined in: GameLib.js. ======= Returns this number rounded to the nearest integer.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Returns:
- The number rounded to the nearest integer. (4.5).round(); // => 5 (4.4).round(); // => 4
<<<<<<< HEAD
=======
{Number}
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
sign()
<<<<<<< HEAD
Defined in: GameLib.js. ======= Get the sign of this number as an integer (1, -1, or 0).
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Defined in: GameLib.js. ======= Get the sign of this number as an integer (1, -1, or 0).
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Returns:
- The sign of this number, 0 if the number is 0.
{Number}
snap(resolution)
<<<<<<< HEAD
Returns the the nearest grid resolution less than or equal to the number.
EX:
=======
Returns the the nearest grid resolution less than or equal to the number.
EX:
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
(7).snap(8) => 0
(4).snap(8) => 0
(12).snap(8) => 8
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Parameters:
- {Number} resolution
- The grid resolution to snap to.
- Returns:
- The nearest multiple of resolution lower than the number.
{Number}
times(iterator, context)
<<<<<<< HEAD
Calls iterator the specified number of times, passing in the number of the
=======
Calls iterator the specified number of times, passing in the number of the
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
current iteration as a parameter: 0 on first call, 1 on the second call, etc.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
- Parameters:
- {Function} iterator <<<<<<< HEAD
- The iterator takes a single parameter, the number
=======
- The iterator takes a single parameter, the number >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff of the current iteration.
- {Object} context Optional
- The optional context parameter specifies an object
to treat as
this
in the iterator block.
- Returns:
- The number of times the iterator was called.
toColorPart()
Defined in: gamelib.js.