Perlin Displacement wave

Hey everyone,

So I was recently working on a project for work where I had some time to mess around with displacement effects. After reading a post by Ordinathorreur (http://www.kirupa.com/forum/showthread.php?t=204877) I was inspired to try and make a wave effect to fade in and out text (but can be used on any MovieClip). So here’s my first version of the PerlinDisplace class which so far only has the pubilc method “wave” shown here. I’m kinda new to writing classes so let me know if you see any room for improvement!

SWF
FLA

Oh and for the next version I’m going to add more control for the fade timing and a few other things when constructing the class. I’ll post again here when its ready-

awesome, thanks!

nice, just add a more detailed map :slight_smile:

WOW! :pope: Very nice! :slight_smile:

Great stuff :slight_smile:

Thanks guys! Glad you are liking it. I’m working on the next version now and I’m adding in more controls to make the wave constant and change it so you are able to control how long the wave last, should be cool

So I’ve fine tuned this class a bit to allow a bit more control. This new version allows you to independently control how long the wave and alpha lasts in seconds, their starting and ending values, and the amplitute and modifer values of the displacement map. I also swapped an image with the text for a bit more of a dramatic effect. Here’s the new source

Hope you guys like it!

(use the SWF link above to see the current version)

Do you think you could post what each of the numbers are? I know that it might be for us beginers but this is one of the coolest ones I’ve seen… I hope to use it, and give due credit of course…

Thanks

sweet! i haven’t seen a transition like this in flash until now. very nice.

Thanks for your comments everyone!

taffy006: Here’s a doc that lists all the perlinNoise parameters, which is what the wave() function mostly needs inputted. I tried to comment the parameters in the .as file for this too, hopefully that will help. :wink:
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001963.html

how come I can’t get it to work with an onEnterFrame command…

basically I want something to ‘fade in’ using the perlindisplacement when the swf starts… rather than when called by a button…

oh and thanks for the quick reply above…

that’s great!

taffy006: you cannot invoke this class using an onEnterFrame command. to use this class you must first create a new object using the PerlinDisplace constructor. Then you start the wave by calling the wave() function and passing the proper parameters. And to start a wave when your movie starts, just import the class and use the wave() function on frame 1 of your animation (instead of attaching it to a button). Hope that makes sense–

serk

any chance you could show me how to make it an object so I can then use it just by invoking it per movieclip rather than just one?

To invoke this on more than one movieclip you need to make another PerlinDisplace object and define the target MC and the height/width of the displacement. So if I have a 100x100 image it would be good to make a displacement of 200x200 or so to accomidate the stretch of the pixels the displacement will make. To do this on two movieclips the code would look like:

var mc1 = new PerlinDisplace(img_mc, 200, 200);
// our second clip, with a larger displacement
var mc2 = new PerlinDisplace(img2_mc, 400, 300);

and when you want to actually begin the displacement you must call it using the wave() function and pass the proper parameters. And that would look like:

mc1.wave(-50, -50 , 125, 125, 0, 0, 2, "color",  12, 0, 0, 100, 1);
mc2.wave(-50, -50 , 125, 125, 0, 0, 2, "color",  12, 0, 0, 100, 1);

thx for your contributions…:slight_smile: