Skip to content

Instantly share code, notes, and snippets.

@ashgti
Created May 12, 2009 16:26
Show Gist options
  • Save ashgti/110571 to your computer and use it in GitHub Desktop.
Save ashgti/110571 to your computer and use it in GitHub Desktop.
function decrSpeed(a, b, c, d) {
if (!c || c == '' || c>100) {
c = 0;
}
if ((!d && c>=a) || (d && c<=a)) {
return c;
}
var r = Math.floor(a-((a-c)/b));
return (((!d && r>=c && r<Math.floor(a)) || (d && r<=c && r>Math.floor(a))) ? r : c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment