7 | | * '''min('''''value1''''', '''''value2''''')''': |
8 | | * '''max('''''value1''''', '''''value2''''')''': |
9 | | * '''clamp('''''value''''', '''''min''''', '''''max''''')''': |
| 9 | * '''min('''''value1''''', '''''value2''''')''': Returns the smaller of two values. |
| 10 | * Example: min(3, 10) = 3, min(2, -2) = -2 |
| 11 | * This is useful, if you don't want a value to be greater than a threshold. Use min(value, threshold). |
| 12 | * '''max('''''value1''''', '''''value2''''')''': Returns the greater of two values. |
| 13 | * Example: max(3, 10) = 10, max(2, -2) = 2 |
| 14 | * This is useful, if you don't want a value to be smaller than a threshold. Use max(value, threshold). |
| 15 | * '''clamp('''''value''''', '''''min''''', '''''max''''')''': Keeps a value between a lower and an upper limit. |
| 16 | * Example: clamp(5, 0, 10) = 5, clamp(100, 0, 10) = 10, clamp(-1, 0, 10) = 0 |
| 17 | * This is like a combination of max and min, used for thresholds |
14 | | * '''floor('''''value''''')''': |
15 | | * '''ceil('''''value''''')''': |
16 | | * '''round('''''value''''')''': |
17 | | * '''mod('''''value''''', '''''max''''')''': |
| 24 | * '''floor('''''value''''')''': Rounds the value down. |
| 25 | * Example: floor(0.2) = 0, floor(0.8) = 0 |
| 26 | * '''ceil('''''value''''')''': Rounds the value up. |
| 27 | * Example: floor(0.2) = 1, floor(0.8) = 1 |
| 28 | * '''round('''''value''''')''': Rounds the value. |
| 29 | * Example: floor(0.2) = 0, floor(0.8) = 1 |
19 | | * '''interpolate('''''time''''', '''''start''''', '''''end''''')''': |
20 | | * '''interpolateSmooth('''''time''''', '''''start''''', '''''end''''')''': |
| 31 | * '''mod('''''value''''', '''''max''''')''': The modulo operation, enhanced to work properly with negative values. |
| 32 | * Example: mod(8, 10) = 8, mod(14, 10) = 4, mod(-8, 10) = 2, mod(-14, 10) = 6 |
22 | | * '''rnd()''': |
23 | | * '''rnd('''''max''''')''': |
24 | | * '''rnd('''''min''''', '''''max''''')''': |
| 34 | * '''interpolate('''''time''''', '''''start''''', '''''end''''')''': Interpolates between two values for a time between 0 and 1. |
| 35 | * '''interpolateSmooth('''''time''''', '''''start''''', '''''end''''')''': Interpolates smoothly between two values for a time between 0 and 1. The function starts slowly, increases faster and stops slowly again. |
| 36 | |
| 37 | * '''rnd()''': Returns a random number between 0 and 1. |
| 38 | * '''rnd('''''max''''')''': Returns a random number between 0 and max. |
| 39 | * '''rnd('''''min''''', '''''max''''')''': Returns a random number between min and max. |