Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple Math extensions

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README.md
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
README.md

math-ext

API

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

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

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

var l = 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.
Something went wrong with that request. Please try again.