Static functions.
public this Crafty.math.abs(Number n)
Absolute value.
Returns the absolute value.
public Number Crafty.math.amountOf(Number checkValue, Number minValue, Number maxValue)
Amount of checkValue compared to minValue and maxValue.
Returns the amount of how much a checkValue is more like minValue (=0) or more like maxValue (=1)
The angle in radian.
The angle in radian.
public Number Crafty.math.distance(Number x1, Number y1, Number x2, Number y2)
The distance between the two points.
Distance between two points.
public Number Crafty.math.lerp(Number value1, Number value2, Number amount)
Linear interpolated value.
Linear interpolation. Passing amount with a value of 0 will cause value1 to be returned, a value of 1 will cause value2 to be returned.
public Number Crafty.math.negate(Number percent)
1 or -1.
Returnes "randomly" -1.
public Number Crafty.math.radToDeg(Number angle)
The angle in degree.
Converts angle from radian to degree.
public Object Crafty.math.randomElementOfArray(Array array)
A random element of a specific array.
Returns a random element of a specific array.
public Number Crafty.math.randomInt(Number start, Number end)
A random int.
Returns a random int in within a specific range.
public Number Crafty.math.randomInt(Number start, Number end)
A random number.
Returns a random number in within a specific range.
public Number Crafty.math.squaredDistance(Number x1, Number y1, Number x2, Number y2)
The squared distance between the two points.
Squared distance between two points.
public Boolean Crafty.math.withinRange(Number value, Number min, Number max)
Returns true if value is within a specific range.
Check if a value is within a specific range.