chore: doc

This commit is contained in:
cha0s 2022-03-23 04:50:41 -05:00
parent 8595b062fc
commit e901873f62

View File

@ -178,6 +178,12 @@ export const randomNumber = (min, max) => {
// smooth(er)?step assumes unit
export const smoothstep = (x) => x * x * (3 - 2 * x);
export const smootherstep = (x) => x * x * x * (x * (x * 6 - 15) + 10);
/**
* Probabilistic behavior. Every `period` seconds, return `true`.
*
* @param {Number} elapsed The time that's passed.
* @param {Number} period The frequency of probabilistic behavior.
*/
export const spontaneous = (elapsed, period) => Math.random() < 1 / (period / elapsed);
export const sub = (l, r) => l - r;
export const toRad = (a) => a * PI_180;