07 December 2009

Repetitive Flash Animation Effects Using FuseKit

Again about FuseKit. It is such wonderful animation tool once you start playing around with it you can't stop.

Because some animation effects are so common I had to write few lines of code to make them easier to use.

First of repetitive Flash animation effect I wanted to replicate is 'breathing effect'. This effect allows movie clip to change it's scale value so it looks like it breaths. I have dummy movie clip logo placed in the center of the stage and code to import FuseKit libraries:



import com.mosesSupposes.fuse.*;
ZigoEngine.simpleSetup( Shortcuts, PennerEasing, Fuse );

var f:Fuse = Fuse.open();
f.label = "animation";
// effect code
Fuse.close();
f.start();

Now, one function solve everything and you put the code instead of commented line above with breath(x); where x is number of iterations. Here is the function:


function breath (a) {
while (a > 0) {
Fuse.addCommand("delay", .5);
Fuse.openGroup();
logo.tween("_yscale", 200, .5, "easeOutCirc");
logo.tween("_xscale", 200, .5, "easeOutCirc");
Fuse.closeGroup();
Fuse.openGroup();
logo.tween("_yscale", 100, 1, "easeOutCirc");
logo.tween("_xscale", 100, 1, "easeOutCirc");
Fuse.closeGroup();
a-=1;
}
}

Breath function can have more parameters if you like, one for delay amount, another for scale value, yet another for animation duration ...

flash animation effect with fusekit
Next repetitive Flash animation effect I wanted to create is 'Jump effect'. Again, I'm using same logo dummy movie clip and make it jump using this function:


function jump (b) {
while (b > 0) {
Fuse.addCommand("delay", .5);
Fuse.openGroup();
logo.tween("_y", 50, .6, "easeOutCirc");
Fuse.closeGroup();
Fuse.openGroup();
logo.tween("_y", Stage.height/2, .6, "easeInCirc");
Fuse.closeGroup();
b-=1;
}
}

If you want to make movie clip bounce when hits the ground you can use easeOutBounce (or some custom variation, perheps?) instead of easeInCirc.

That's all for now, more of these effects some other time.

*_*

0 comments:

 

template by blogger templates