Methods
(static) clamp(value, min, max) → {number}
Clamps a number between a minimum and maximum value.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | the number to clamp |
min |
number | the minimum value |
max |
number | the maximum value |
Returns:
clamped value
- Type
- number
(static) ease_in_exp(t) → {number}
Exponential easing in function. Returns a number in range [0, 1].
Parameters:
| Name | Type | Description |
|---|---|---|
t |
number | input number in range [0, 1] |
Returns:
eased value
- Type
- number
(static) ease_in_out_exp(t) → {number}
Exponential easing in-out function. Returns a number in range [0, 1].
Parameters:
| Name | Type | Description |
|---|---|---|
t |
number | input number in range [0, 1] |
Returns:
eased value
- Type
- number
(static) ease_in_out_poly(t, n) → {number}
Polynomial easing in out function. Returns a number in range [0, 1].
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
t |
number | input number in range [0, 1] | |
n |
number | 2 | power of the easing function. Default is 2 (quadratic easing) |
Returns:
eased value
- Type
- number
(static) ease_in_out_sin(t) → {number}
Sinusoidal easing in-out function. Returns a number in range [0, 1].
Parameters:
| Name | Type | Description |
|---|---|---|
t |
number | input number in range [0, 1] |
Returns:
eased value
- Type
- number
(static) ease_in_poly(t, n) → {number}
Polynomial easing in function. Returns a number in range [0, 1].
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
t |
number | input number in range [0, 1] | |
n |
number | 2 | power of the easing function. Default is 2 (quadratic easing) |
Returns:
eased value
- Type
- number
(static) ease_in_sin(t) → {number}
Sinusoidal easing in function. Returns a number in range [0, 1].
Parameters:
| Name | Type | Description |
|---|---|---|
t |
number | input number in range [0, 1] |
Returns:
eased value
- Type
- number
(static) ease_out_exp(t) → {number}
Exponential easing out function. Returns a number in range [0, 1].
Parameters:
| Name | Type | Description |
|---|---|---|
t |
number | input number in range [0, 1] |
Returns:
eased value
- Type
- number
(static) ease_out_sin(t) → {number}
Sinusoidal easing out function. Returns a number in range [0, 1].
Parameters:
| Name | Type | Description |
|---|---|---|
t |
number | input number in range [0, 1] |
Returns:
eased value
- Type
- number
(static) i_to_point(i, width) → {Point}
Converts a linear index to a Point instance.
Parameters:
| Name | Type | Description |
|---|---|---|
i |
number | linear index |
width |
number | row width |
Returns:
point at the computed coordinates
- Type
- Point
(static) i_to_xy(i, width) → {Array.<number>}
Converts a linear index to 2D coordinates.
Parameters:
| Name | Type | Description |
|---|---|---|
i |
number | linear index |
width |
number | row width |
Returns:
tuple of [x, y]
- Type
- Array.<number>
(static) lerp(a, b, t) → {number}
Linearly interpolates between two values.
Parameters:
| Name | Type | Description |
|---|---|---|
a |
number | start value |
b |
number | end value |
t |
number | interpolation factor in range [0, 1] |
Returns:
interpolated value
- Type
- number
(static) point_to_i(point, width) → {number}
Converts a Point instance to a linear index.
Parameters:
| Name | Type | Description |
|---|---|---|
point |
Point | point to convert |
width |
number | row width |
Returns:
linear index
- Type
- number
(static) remap(value, old_min, old_max, new_min, new_max) → {number}
Remaps a number from one range to another.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | the number to remap |
old_min |
number | the lower bound of the value's current range |
old_max |
number | the upper bound of the value's current range |
new_min |
number | the lower bound of the value's target range |
new_max |
number | the upper bound of the value's target range |
Returns:
remapped value
- Type
- number
(static) wrap(value, min, max) → {number}
Wraps a value into the range [min, max).
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | the number to wrap |
min |
number | the inclusive lower bound |
max |
number | the exclusive upper bound |
Returns:
wrapped value
- Type
- number
(static) xy_to_i(x, y, width) → {number}
Converts 2D coordinates to a linear index.
Parameters:
| Name | Type | Description |
|---|---|---|
x |
number | x coordinate |
y |
number | y coordinate |
width |
number | row width |
Returns:
linear index
- Type
- number