Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
static norm(value, min, max) {
return (value - min) / (max - min);
static lerp(norm, min, max) {
return ((max - min) * norm) + min;
static map(value, sourceMin, sourceMax, destMin, destMax) {
return this.lerp(this.norm(value, sourceMin, sourceMax), destMin, destMax);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment