Note that your code appears possibly add multiple onComplete event listeners to the fx instances, which I think would cause trouble.
On Thu, Jan 15, 2009 at 1:20 PM, David Nolen (via Nabble) < [email protected]<ml-user%[email protected]> > wrote: > 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 > <anut...@...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2164978&i=0> > > 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. >> > > > > ------------------------------ > View message @ > http://n2.nabble.com/Generalized-FxChain-Solution-tp2164944p2164978.html > To start a new topic under MooTools Users, email > [email protected]<ml-node%[email protected]> > To unsubscribe from MooTools Users, click here< (link removed) >. > > > ----- The MooTools Tutorial: http://www.mootorial.com www.mootorial.com Clientcide: http://www.clientcide.com www.clientcide.com -- View this message in context: http://n2.nabble.com/Generalized-FxChain-Solution-tp2164944p2165214.html Sent from the MooTools Users mailing list archive at Nabble.com.
