math-ext

0.0.1 • Public • Published

math-ext

API

var m = require('math-ext');

m.clamp(1, 2, 3) // => 2
m.clamp(1, 2, 0.5) // => 1
m.clamp(1, 2, 1.5) // => 1.5

m.lerp(0, 2, 0.75) // => 1.5

var c = m.clamper(1, 2)
c(4) // => 2
c(0.2) // => 1

var l = m.lerper(0, 10)
l(0.5) // => 5

Expose globally

require('math-ext').expose();

typeof Math.clamp // => "function"
typeof Math.lerp // => "function"
// you get the idea.

/math-ext/

    Package Sidebar

    Install

    npm i math-ext

    Weekly Downloads

    2

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • jaz303