Skip to content

Instantly share code, notes, and snippets.

@philipnrmn
Created August 20, 2013 15:34
Show Gist options
  • Save philipnrmn/6283064 to your computer and use it in GitHub Desktop.
Save philipnrmn/6283064 to your computer and use it in GitHub Desktop.
Jerky easing in jQuery
(function($) {
// The bigger the step, the jerkier the animation
var step = 0.11,
lastStep = 0;
$.easing.jerky = function(t) {
if (t < step)
lastStep = 0;
if (t > lastStep + step)
lastStep += step;
return lastStep;
};
}(jQuery));
// example usage with jQuery UI components:
$('.accordion').accordion({ animate: 'jerky' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment