Packages

A web application in pursuit of meaning in life.

Retired package: Complete rewrite, scratch old versions

Current section

Files

Jump to
udia assets node_modules mout math map.js
Raw

assets/node_modules/mout/math/map.js

var lerp = require('./lerp');
var norm = require('./norm');
/**
* Maps a number from one scale to another.
* @example map(3, 0, 4, -1, 1) -> 0.5
*/
function map(val, min1, max1, min2, max2){
return lerp( norm(val, min1, max1), min2, max2 );
}
module.exports = map;