A jQuery plugin from GSGD to give advanced easing options.
Download the following:
Click on any of the yellow headers to see the default easing method in action (I've set as easeOutBounce for the demo, just because it's obviously different). All done with a straight animate call, no need to specify the animation type at all.
Select easing types for the demo first one for down, second one for up. Then click the clicker.
Uses Robert Penners easing equations for the transitions.
If you use this in a commercial project, you might consider a buying me a beer by way of thanks. Use the button below to donate to the beer fund via paypal.
Choose a default easing method to overwrite the standard 'swing' animation. The easing default is 'easeOutQuad', specify your own using the following:
jQuery.easing.def = "string";
Where string is one of the equation names. The old swing function is renamed to jswing.
There are two ways to specify a custom easing method, the following are functionally identical:
$(element).slideUp(1000, method, callback}); $(element).slideUp({ duration: 1000, easing: method, complete: callback });
duration: is basically speed, so milliseconds or slow/fast will work here.
easing: takes an ease method see below for options (note to previous users of the plugin this has changed from easeMethod)
callback: takes a pre defined function name or an anonymous function() {} block.
Please note, you can't mix the syntax, use one format or the other, or it won't work properly.
jQuery.easing.method() All your scripts can use these equations. Call from some kind of time based loop as follows:
jQuery.easing.method( null†, current_time, start_value, end_value, total_time )
† this is an extra parameter not needed for the equations, but necessary for compatibility with jQuery
© 2024 GSGD