Wednesday, March 26, 2008

TurbulenceFX




View SWF online
Download source
Download SWC
Download SWC source


At last~it's done!!
I've finally finished making the TurbulenceFX component.
Now you can use TurbulenceFX simply by dragging this from your component library into FLA library.

It has the following parameters:
radius, strength are too easy to understand.
baseX, baseY, fractalNosie, offsetX, offsetY are perlinNoise() parameters; go check the Flash help file.

And just like other FX components, don't forget to continuously call TurbulenceFX.refresh() by yourself!

Tuesday, March 25, 2008

TurbulenceFX prototype




View SWF online
Download source


I'm currently working on a component producing such turbulence effect.
Obviously I'm using BitmapData.perlinNoise().
But I want the effect to have smooth borders in order to merge perfectly with the DisplayObject below.
So I used a circle with gradient fill (see the FLA source file) to achieve this goal.

Sunday, March 23, 2008

MagnifierFX





View SWF online
Download source
Download SWC


I've been working on this for an entire afternoon.
And finally...it's done!!

It's simply a component making usage of the DisplacementMapFilter.
Anytime I want to use this effect, I find it quite painful.
Since I have to recreate every code and elements from scratch.
So I decided to make this into a component.

To use MagnifierFX, all you have to do is drag it out from the component library.
(Be sure to add the SWC file into your Flash's comopnent directory)

There're only four parameters for you to adjust:

1. outerRadius - the outer radius of the magnifier.
2. innerRadius - the inner radius of the magnifier.
(this is quite difficult to explain, actually. just watch the SWF demo above.)

3. strength - how strong this effect is aplied.
4. target - the DisplayObject to be used with this effect
(not that this DisplayObject has to be in the same parent as MagnifierFX)
And remember to call refresh() to redraw the effect by yourself!!
(this is for CPU-efficiency's sake)

Chaser




View SWF online
Download source
Download API


Having a DisplayObject shasing the mouse cursor or another DisplaObject is a pretty common effect seen in lots of Flash movies and games.

Since I'm too lazy to type down the same code again and again in every Flash file,
I decided to make this function into an API and eliminate this chore once and for all.

Chaser is quite easy to use, really.
Here's a simple piece of code:

import idv.cjcat.utils.*;
import idv.cjcat.events.*;

Chaser.addChaser(chaser, target, ChaserMode.ATTRACT, 0.5);
Chaser.chaserInfo.addEventListener(ChaserEvent.REACHED, reached);

function reached(e:ChaserEvent):void {
trace("chaser's raeched its target at: (" + e.chaser.x " + ", " + e.chaser.y + ")");
}


Both chaser and target are DisplayObjects.
If target has a null value, which is default, the chaser would chase the mouse cursor, instead.

There are two ChaserModes:
1. DIRECT - the chaser's velocity always points to its target.
2. ATTRACT - the chaser's acceleration always points to its target, which is more like a "bouncy spring" effect.


Hope you find this little tool handy :)


GlowFX




View SWF online
Download source
Download SWC


I made this into a component;
so whenever I want to use this effect,
all I have to do is drag it out from the component library window in Flash.

I't s mechanism is quite simple:
1. Copy the pixels below GlowFX.
2. Use BitmapData.threshold() to clear out pixels that are not of the target color.
3. Apply GlowFilter to this BitmapData.
4. Done!

Great, my first blog

Hi, everyone. This is my first blog, in fact (If you don't consider the journal in DeviantART as one).

I'll post mostly articles concerning my researches on ActionScript, artwork showcase (or WIP works), and some casual journals.

Cheers :)