In reponse to TGurske. This allows you to sequence Fx using the standard chain syntax, they can be unrelated animations, and you can call clearChain to cancel the whole thing midway. My bad if that's already possible.
On Thu, Jan 15, 2009 at 4:16 PM, nutron <[email protected]> wrote: > Um. Why do you need this? What purpose does this code serve? > > > On Thu, Jan 15, 2009 at 1:13 PM, David Nolen (via Nabble) < > ml-user%2b121260-1348229...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2164958&i=0> > > wrote: > >> window.addEvent('domready', run); >> >> var FxChain = new Class({ >> >> name: "FxChain", >> >> Extends: Chain, >> Implements: Events, >> >> initialize: function() >> { >> this.chain(arguments); >> this.running = []; >> }, >> >> callChain: function() >> { >> var fx = this.parent(); >> if(fx) >> { >> this.running.push(fx); >> fx.addEvent('onComplete', this.callChain.bind(this)); >> } >> }, >> >> clearChain: function() >> { >> this.running.each(function(fx) {fx.cancel();}); >> this.parent(); >> } >> >> }); >> >> var myChain; >> function run() >> { >> $('red').set('tween', { >> duration: 500, >> transition: Fx.Transitions.Cubic.easeIn >> }); >> $('green').set('tween', { >> duration: 500, >> transition: Fx.Transitions.Cubic.easeOut >> }); >> $('blue').set('tween', { >> duration: 500, >> transition: Fx.Transitions.Cubic.easeOut >> }); >> >> myChain = new FxChain( >> function() { return $('red').get('tween').start('left', 200); }, >> function() { return $('green').get('tween').start('left', 400); }, >> function() { return $('blue').get('tween').start('left', 600); } >> ); >> >> myChain.callChain(); >> } >> >> Note that with FxChain you MUST return the animation as a return value of >> each function in the chain. >> > > The MooTools Tutorial: www.mootorial.com Clientcide: www.clientcide.com > > ------------------------------ > View this message in context: Re: Generalized FxChain > Solution<http://n2.nabble.com/Generalized-FxChain-Solution-tp2164944p2164958.html> > Sent from the MooTools Users mailing list > archive<http://n2.nabble.com/MooTools-Users-f660466.html>at Nabble.com. >
