mapValue function

double mapValue(
  1. num value,
  2. num start1,
  3. num stop1,
  4. num start2,
  5. num stop2,
)

Implementation

double mapValue(num value, num start1, num stop1, num start2, num stop2) {
  return (value - start1) / (stop1 - start1) * (stop2 - start2) + start2;
}