UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

12 lines (11 loc) 311 B
/** * Positive number produce 1, negative -1 and 0 produces 0. * * Standard implementation in graphics languages such as HLSL and GLSL * * @param {number} v * @returns {number} +1 if `v > 0`, 0 if `v == 0`, -1 if `v < 0` */ export function sign(v) { return v > 0 ? 1 : (v < 0 ? -1 : 0); }