jQuery Easing Plugin v1.1

A jQuery plugin from GSGD to give advanced easing options. Uses Robert Penners easing equations for the transitions.

Useage

Standard

Since jQuery 1.1, the plugin no longer needs to touch jQuery, this is good for future compatability as nothing will break unless they remove easing support, and seeing as they've just added it in, I can't see that happening.

I've removed support for overwriting the default equation, so you'll need to specify which equation you're using every time.

To specify the easemethod you just need to tell the speed function which one like so:

$(element).slideUp({duration: 1000, easing: method});

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)

Download jquery.easing.1.1.js here (3.21KB)

Bonus feature

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

Updates

17/01/07 09:11 1.1 - Redone for jQuery 1.1 - older version can be found here

04/09/06 15:38 1.0b - Fixed a problem with the regex to help ie play nice...

04/09/06 20:34 1.0c - Replaced the whole fx function instead, other browsers should now work...

07/09/06 08:05 1.0d - Gone back to regex - managed to test on Konqueror. Also managed to package things up so now extra equations are optional and you can pass an equation function in...

07/09/06 12:28 1.0e - Updated regex so it now works on Opera browsers. Got rid of eval() for Function(). Used jQuery.extend to add equations...

Examples

toggle

easein

toggle

easeinout

toggle

easeout

toggle

expoin

toggle

expoinout

toggle

expoout

toggle

bouncein

toggle

bounceinout

toggle

bounceout

toggle

elasin

toggle

elasinout

toggle

elasout

toggle

backin

toggle

backinout

toggle

backout

© 2006 GSGD