Finish documentation
This commit is contained in:
parent
49473bf905
commit
31fcfd3d6b
86 changed files with 1383 additions and 8485 deletions
|
|
@ -1,3 +1,4 @@
|
|||
/** @internal */
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
x: number;
|
||||
|
|
@ -10,6 +11,7 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
const setIndexAlias = (name: string, index: number, type: any) => {
|
||||
if (!Object.prototype.hasOwnProperty.call(type.prototype, name)) {
|
||||
Object.defineProperty(type.prototype, name, {
|
||||
|
|
@ -23,6 +25,7 @@ const setIndexAlias = (name: string, index: number, type: any) => {
|
|||
}
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export const applyArrayPlugins = () => {
|
||||
setIndexAlias('x', 0, Array);
|
||||
setIndexAlias('y', 1, Array);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
/** @internal */
|
||||
export const clamp = (value: number, min: number, max: number): number =>
|
||||
Math.min(max, Math.max(min, value));
|
||||
|
||||
/** @internal */
|
||||
export const clamp01 = (value: number): number => Math.min(1, Math.max(0, value));
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @internal */
|
||||
export const exponentialDecay = (
|
||||
accumulator: number,
|
||||
nextValue: number,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @internal */
|
||||
export const getCombinations = (values: Array<Array<number>>): Array<Array<number>> => {
|
||||
if (!values.every((a) => a.length > 0)) {
|
||||
return [];
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @internal */
|
||||
export function last<T>(a: Array<T>): T | null {
|
||||
return a.length > 0 ? a[a.length - 1] : null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
/** @internal */
|
||||
export const mix = (from: number, to: number, q: number) => from + (to - from) * q;
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
/** @internal */
|
||||
export const msToString = (value: number) => `${value.toFixed(3)} ms`;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/** @internal */
|
||||
export const wait = (ms: number): Promise<void> => {
|
||||
return new Promise<void>((resolve, _) => setTimeout(resolve, ms));
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue