3.4.0 • Published 2 years ago

missing-math v3.4.0

Weekly downloads
5
License
MIT
Repository
github
Last release
2 years ago

missing-math

missing features of the Math built-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.

3.4.0

2 years ago

3.3.0

2 years ago

3.2.0

4 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago