mattlundstrom
8/26/2013 - 7:57 PM

Map a value from one range to another

Map a value from one range to another

function map(_val, _min1, _max1, _min2, _max2)
{
  return ((_val - _min1)/(_max1 - _min1)) * (_max2 - _min2) + _min2;
}