Skip to content

Instantly share code, notes, and snippets.

@loganzartman
Last active August 29, 2015 14:15
Show Gist options
  • Save loganzartman/c022bba4cc3400ef3c2e to your computer and use it in GitHub Desktop.
Save loganzartman/c022bba4cc3400ef3c2e to your computer and use it in GitHub Desktop.
will be used for robot
function ramp(t, min, max, fluff) {
var diff = t>fluff?1-t:t;
var deaden = 0;
if (diff < fluff)
deaden = (fluff-diff)/fluff;
return min+(max-min)*(1-deaden);
}
var min = 1, max = 10;
for (var i=0; i<=max; i++) {
console.log(ramp(i, min, max, 3))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment