UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

112 lines 2.69 kB
export class NumericInterval { /** * * @param {number} [min=-Infinity] * @param {number} [max=Infinity] * @constructor */ constructor(min?: number, max?: number); /** * * @type {number} */ min: number; /** * * @type {number} */ max: number; /** * @readonly * @type {Signal<number, number, number, number>} */ readonly onChanged: Signal<number, number, number, number>; /** * * @param {number} min * @param {number} max */ set(min: number, max: number): void; /** * * @param {number} value */ multiplyScalar(value: number): void; /** * Compute normalized position of input within this interval, where result is 0 if input is equal to `min`, and 1 when input is equal to `max` * @param {number} v value to be normalized * @returns {number} value between 0..1 if input is within [min,max] range, otherwise result will be extrapolated proportionately outside the 0,1 region */ normalizeValue(v: number): number; /** * Both min and max are exactly 0 * @returns {boolean} */ isZero(): boolean; /** * Whether min and max are the same * In other words if span is 0 * @returns {boolean} */ isExact(): boolean; /** * * @returns {number} */ computeAverage(): number; /** * * @param {function} random Random number generator function, must return values between 0 and 1 * @returns {number} */ sampleRandom(random: Function): number; fromJSON(json: any): void; toJSON(): { min: number; max: number; }; toString(): string; /** * * @param {BinaryBuffer} buffer */ toBinaryBuffer(buffer: BinaryBuffer): void; /** * * @param {BinaryBuffer} buffer */ fromBinaryBuffer(buffer: BinaryBuffer): void; /** * * @param {NumericInterval} other */ copy(other: NumericInterval): void; /** * * @param {NumericInterval} other * @returns {boolean} */ equals(other: NumericInterval): boolean; /** * * @returns {number} */ hash(): number; /** * Distance between min and max (= max - min) * @returns {number} */ get span(): number; /** * @readonly * @type {boolean} */ readonly isNumericInterval: boolean; } export namespace NumericInterval { let zero_zero: NumericInterval; let zero_one: NumericInterval; let one_one: NumericInterval; } import Signal from "../../events/signal/Signal.js"; //# sourceMappingURL=NumericInterval.d.ts.map