UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

13 lines (11 loc) 397 B
/** * compute the fractional part of the argument * GLSL "fract" function port * @see https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/fract.xhtml * @param {number} v * @returns {number} returns the fractional part of x. This is calculated as x - floor(x). */ export function fract(v) { const whole = v >> 0; // fast way to cut off fraction return v - whole; }