- Source:
Classes
Namespaces
Methods
(static) constrain(val, start, end) → {Number}
Constrains a number between the specified range
- Source:
Parameters:
Name | Type | Description |
---|---|---|
val |
Number
|
The number to be constrained |
start |
Number
|
The minimum number that the specified one can be |
end |
Number
|
The maximum number that the specified one can be |
Returns:
- Type:
-
Number
The constrained number
(static) dist(x1, y1, x2, y2) → {Number}
Returns the distance between the specified points (See: UMath.distSq
)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
x1 |
Number
|
The x of the first point |
y1 |
Number
|
The y of the first point |
x2 |
Number
|
The x of the second point |
y2 |
Number
|
The y of the second point |
Returns:
- Type:
-
Number
The distance between the two points
(static) distSq(x1, y1, x2, y2) → {Number}
Returns the squared distance between two points (See: UMath.dist
)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
x1 |
Number
|
The x of the first point |
y1 |
Number
|
The y of the first point |
x2 |
Number
|
The x of the second point |
y2 |
Number
|
The y of the second point |
Returns:
- Type:
-
Number
The squared distance between the two points
(static) lerp(val, target, perc) → {Number}
Linearly interpolates the specified number to the specified target
- Source:
Parameters:
Name | Type | Description |
---|---|---|
val |
Number
|
The number to interpolate |
target |
Number
|
The target of the specified value |
perc |
Number
|
How near value should be to target [0; 1] |
Returns:
- Type:
-
Number
The interpolated value
(static) map(val, start1, end1, start2, end2, constrain) → {Number}
Maps the specified value that is in the range [start1; end1] to the new range [start2; end2]
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
val |
Number
|
The value to be mapped |
|
start1 |
Number
|
The start of the value's range |
|
end1 |
Number
|
The end of the value's range |
|
start2 |
Number
|
The start of the value's new range |
|
end2 |
Number
|
The end of the value's new range |
|
constrain |
Boolean
|
false |
Whether or not the mapped value should be contrained to the new range |
Returns:
- Type:
-
Number
The mapped value