Skip to content

Instantly share code, notes, and snippets.

Last active March 9, 2018 21:54
What would you like to do?
(JS) Scale Numbers Between a Given Range
// Code snippet taken from:
function scaleBetween(unscaledNum, minAllowed, maxAllowed, min, max) {
return (maxAllowed - minAllowed) * (unscaledNum - min) / (max - min) + minAllowed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment