ChainedTweener class

April 20, 2008

As i wrote in my previous post : BaseTweener class, ive made a class that extends the BaseTweener class to show an example of the usability of making an extensible tweener class.

So in this ChainedTweener class i’m gonna extend the BaseTweener class and make it execute tweenings in a cool easy chained way, so to have a glimpse of how this class can be used here’s an example :

var tweener:ChainedTweener = new ChainedTweener(_targetSprite, new Array("x","y")) ;
tweener = tweener.chainedTweenTo(new Array(100,200)).chainedTweenTo(new Array(50,300)).chainedTweenTo(new Array(1,10))

this will make a sequence of tweenings that will execute one after another, the benefits of this method is that you don’t have to worry about calculating delays to execute a sequence of tweenings anymore, and this class has the same functionalities as the BaseTweening class since this extends that.

Is there more examples of this ?

Off course, here’s a page of an example with the Document class code. In this example i’ve set the loop property of the ChainedTweener object to true, this makes the sequence of tweenings get inverted at its end. see here.

Explain more, how this exactly works and what can be done more ?

Actually what this class does is when the methods chainedTweenTo or chainedTweenFromTo are called, the tweener object creates a clone of itself, calculates the delay in function of how much tweening to go before he can fire, then pushes the clone into a static array, then the clone just pushed executes his tweening.

Also i’ve created a ChainedTweenerEvent class the contains the different events needed to listen to the chained tweenings. this class adds to the BaseTweener events a bunch of chainedTweener events that are fired when the chainedTweenTo and chainedTweenFromTo methods are used. Cool animations can happen when using the yoyo and the loop properties too.

So what can done more? well i plan to add the feature of defining sequences, store them , than call them whenever you need them, yeah , that’s definitely in my 2 do list.

Can you rapidly show me how did you extend the BaseTweener class and made this class out of it ?

yes, here’s the ChainedTweener actionscript file, see here.

Ok, i want to download this class :)

There you go, this archive file contains examples files + source files (ChainedTweener.as + ChianedTweenerEvent.as), download here (this has the file extension .jpeg but it’s a .rar file, i had to do that in order to host it here, please click : saveTargetAs or SaveLinkAs then when finished downloading change it’s extension to .rar, sorry for the extra work you have to do, i’ll be fixing that soon).

BaseTweener Class

April 15, 2008

I’ve been working with Sam Bouguerra on some flash projects for a while now, and it is really a great experience working with professionals such as Bouguerra. So he gave me some libraries he’s been developing for i could base my work on them. One great class in the YLib he’s been developing is the Tweener class, and frankly i’ve tried so many Tweening classes available such as caurina’s tweening class, and Moses Supposes’ class and really some other cool stuff, but the thing that i’ve noticed is that none of those (and please correct me if i’m wrong) … none of those are extensible classses, and what i’ve also noticed is that sequencing (chaining) is somehow supported in a not very clear way, it’s mainly supported using delays and manual configurations. So i decided to make a tweening class that is first extensible, and to show the usefulness of this extensibility i decided to make a cool inherited ChainedTweener class which works in a similar way to the JQuery chaining logic to make chained tweening (cool right, see my next post to check the ChainedTweener class out)

What is BaseTweener ?

BaseTweener is a very straightforward easy to use tweening class. It’s extensible, it supports delay, and supports a wide variety of general known tweening features.

Why should i use BaseTweener ?

the main feature of the BaseTweener class is that is extensible, i’m gonna show in my next post how can i extend my BaseTweener class to make it chainable in a very elegant, handy and easy way.

How can i use BaseTweener ?

I’ve made an example showing how to make a tweening in the very simple way :

go to Example

Finally, where the heck is the download Link ?

there you go : BaseTweener.rar , size 17Ko | archive contains : example files + source files. (this has the file extension .jpeg but it’s a .rar file, i had to do that in order to host it here, please click : saveTargetAs or SaveLinkAs then when finished downloading change it’s extension to .rar, sorry for the extra work you have to do, i’ll be fixing that soon).

how come this is not on some svn server ?

as i said the YLib library is still under heavy development, and it’s not my right to make it public yet.

Hello world!

April 11, 2008

Feed you inner Beatle !