Returns an element wrapped in an array or unchanged when it's already an array.
function refineArray<T>(arr: T | T[]): T[];Combines two similar arrays.
function concatArray<T>(arr1: T[], arr2: T[]): T[];Removes an element from an array without generating garbage.
function arrayRemove<T>(arr: T[], item: T): boolean;function isTouchDevice(): boolean;Set of easing functions for a smooth motion. https://matthewlein.com/tools/ceaser
interface easing {
linear
// quadratic functions
easeInQuad
easeOutQuad
easeInOutQuad
// cubic functions
easeInCubic
easeOutCubic
easeInOutCubic
// quartic functions
easeInQuart
easeOutQuart
easeInOutQuart
// quintic functions
easeInQuint
easeOutQuint
easeInOutQuint
// elastic functions
easeInElastic
easeOutElastic
easeInOutElastic
}Linear interpolation between two values.
function lerp(
start: number, // returned when bias = 0
end: number, // returned when bias = 1
bias: number, // [0-1] interpolation between start and end
error: number = 0 // snaps bias to the start or end
): number;Returns the sign of the number. It indicates whether the given number is positive, negative or zero.
function sign(value: number): -1 | 0 | 1;Returns a random integer number between min (inclusive) and max (inclusive) values.
function randomInt(): number; // 0-1
function randomInt(max: number): number; // 0-max
function randomInt(min: number, max: number): number; // min-maxReturns a random float number between min (inclusive) and max (inclusive) values.
function randomFloat(): number; // 0-1
function randomFloat(max: number): number; // 0-max
function randomFloat(min: number, max: number): number; // min-maxTiming methods based on window.requestAnimationFrame() which tells the browser to call specified function before the next repaint.
https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
It's similar to the native setTimeout function in JavaScript.
function setFrameTimeout(callback: () => void, delay: number = 0): IAnimationFrameRequest;It's similar to the native setInterval function in JavaScript.
function setFrameInterval(callback: () => void, delay: number = 0): IAnimationFrameRequest;Clears both setFrameTimeout and setFrameInterval methods.
function clearFrameRequest(request: IAnimationFrameRequest | void): void;