This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // based on https://github.com/processing/processing/blob/a6e0e227a948e7e2dc042c04504d6f5b8cf0c1a6/core/src/processing/core/PApplet.java#L5093 | |
| var scale = function(opts){ | |
| var istart = opts.domain[0], | |
| istop = opts.domain[1], | |
| ostart = opts.range[0], | |
| ostop = opts.range[1]; | |
| return function scale(value) { | |
| return ostart + (ostop - ostart) * ((value - istart) / (istop - istart)); |