function map(n, start1, stop1, start2, stop2) {
  return ((n - start1) / (stop1 - start1)) * (stop2 - start2) + start2;
}
Maps the value `n` which ranges between `start1` and `stop1`
to `start2` and `stop2`.

@param {number} n
@param {number} start1
@param {number} stop1
@param {number} start2
@param {number} stop2