jQuery animation queue with common easing -
i have jquery animations queued single element:
var el = $('.elem'); el.animate({ width: 120 }, 600, 'easeinoutquint' ).animate({ width: 90 }, 300, 'easeinoutquint' ).animate({ width: 100 }, 100, 'easeinoutquint' );
the 3 animation counts 1 main animation, chained. takes 1000ms run , use in example first animation first 60% of easing, easing next 30% used in second animation , finished last 10% of easing.
is there way make easing global value these queued animations?
if understand question correctly, maybe can wrap logic in function can pass in duration , reuse chained animation this:
var el = $('.elem'); var ease = function(elem, duration) { elem .animate({width: 120}, 0.6 * duration, 'easeinoutquint') .animate({width: 90}, 0.3 * duration, 'easeinoutquint') .animate({width: 100}, 0.1 * duration, 'easeinoutquint'); } ease(el, 1000);
Comments
Post a Comment