3.4.0 • Published 3 years ago
missing-math v3.4.0
missing-math
missing features of the
Mathbuilt-in object
Usage
Import with a module bundler
$ npm install --save missing-math// using ES6 module
import { clamp, degrees } from 'missing-math'
// using CommonJS module
var { clamp, degrees } = require('missing-math')Import from a browser
<script src="https://unpkg.com/missing-math"></script>
<script>
// all methods are exposed in window.MissingMath
MissingMath.clamp()
MissingMath.degrees()
</script>Methods
clamp(value, min, max)wrap(value, min, max)normalize(value, min, max[, clamp = false])map(value, in_min, in_max, out_min, out_max[, clamp = false])lerp(a, b, t)random(a[, b])degrees(radians)radians(degrees)roundTo(value, nearest)floorTo(value, nearest)fract(value[, decimals])
License
MIT.