Created
March 24, 2020 11:57
-
-
Save apostololeg/3846e5b80202facc48c2957ed70bd024 to your computer and use it in GitHub Desktop.
This file contains 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
// Thx to: https://gist.github.com/xposedbones/75ebaef3c10060a3ee3b246166caab56#gistcomment-2951694 | |
// map(4, ...[0, 20], ...[.3, 0]) // .24 | |
const map = (value, x1, y1, x2, y2) => (value - x1) * (y2 - x2) / (y1 - x1) + x2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment