Created
August 20, 2013 15:34
-
-
Save philipnrmn/6283064 to your computer and use it in GitHub Desktop.
Jerky easing in jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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