Skip to content

Instantly share code, notes, and snippets.

@WillSquire
Last active August 29, 2015 14:23
Show Gist options
  • Save WillSquire/3f1ebd3ec3e6cd3a805e to your computer and use it in GitHub Desktop.
Save WillSquire/3f1ebd3ec3e6cd3a805e to your computer and use it in GitHub Desktop.
LERP - Get from point a to point b over t.
/**
* Linear interpolation (LERP).
*
* Returns a value between value a to value b over t (0 to 1).
*
* @param {number} a
* @param {number} b
* @param {number} t
* @returns {number}
*/
function lerp(a, b, t) {
return a + t * (b - a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment