PDA

View Full Version : Perlin Displacement wave



serkios
March 23rd, 2006, 09:26 PM
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 (http://gdinteractive.com/dev/PerlinDisplace/)
FLA (http://gdinteractive.com/dev/PerlinDisplace/PerlinDisplace_mod.zip)

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-

kallisti
March 24th, 2006, 12:13 AM
awesome, thanks!

eilsoe
March 24th, 2006, 01:43 AM
nice, just add a more detailed map :)

Pattt
March 24th, 2006, 08:37 AM
WOW! :pope: Very nice! :)

Ordinathorreur
March 24th, 2006, 10:44 AM
Great stuff :)

serkios
March 24th, 2006, 03:44 PM
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 (http://gdinteractive.com/dev/PerlinDisplace/PerlinDisplace_mod.zip)

Hope you guys like it!

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

taffy006
March 25th, 2006, 09:27 PM
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

treatkor
March 25th, 2006, 09:38 PM
sweet! i haven't seen a transition like this in flash until now. very nice.

serkios
March 25th, 2006, 11:28 PM
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. ;)
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001963.html

taffy006
March 26th, 2006, 01:11 AM
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..

taffy006
March 26th, 2006, 01:12 AM
oh and thanks for the quick reply above..

sed|thh
March 26th, 2006, 04:23 AM
that's great!

serkios
March 26th, 2006, 11:52 AM
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

taffy006
March 26th, 2006, 10:44 PM
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?

serkios
March 27th, 2006, 10:46 PM
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);

e-sarbak
March 29th, 2006, 01:38 PM
thx for your contributions...:)

fuekewl
November 14th, 2006, 09:37 AM
The links to the SWF and FLA are dead ... :(

I also wanna see this =) , can someone please post it again?

Thanks so much!

dimitri_c
November 14th, 2006, 02:40 PM
http://gdinteractive.com/
Go on last tab

- Dimitri http://www.thebend.be/personal/

fuekewl
November 15th, 2006, 02:35 AM
thank you, nice portfolio site too. =)

Just to make sure, is it the BitmapDisplace Class that's on the site thats being referred to in this thread? or am I missing something?

dimitri_c
November 15th, 2006, 06:44 AM
Yeah it was.

But tell me fuelkewl, when you compile the the .FLA source of this class, do you encounter an "this" error?
Because, for some strange reason(s) I always have an error, and I was obliged to embed directly the class into my .FLA file.

NB. You may see the present 'class' applied on the website I given you ( http://www.thebend.be/personal/ ). It's when the final text disappear with a fade effect (that's the perlin class in use)

Have a nice day…


- Dimitri http://www.thebend.be/can5/

fuekewl
November 21st, 2006, 09:46 AM
@dimitri: sorry been away from computer for nearly a solid week ... the joy!

hmm .. dunno about the error you experiencing. Also I don't think I've got the Perlin Class from either site, only a BitmapDisplacement class from http://gdinteractive.com/, and a very kewl transition from your portfolio site.

I'm assuming that that cool text transition is the Perlin class in action?

Come to think of it, your "this" error sounds like you using a class that extends a movieclip, but are not referencing it in the Linkage Properties.

Can you please post that perlin displace class here, because I can't find it anywhere. :upset:

Thanks again!

dimitri_c
November 21st, 2006, 03:49 PM
Hello fuekewl -

Woud you mind to explain me a little more:
"Come to think of it, your "this" error sounds like you using a class that extends a movieclip, but are not referencing it in the Linkage Properties."

Thank you…


- Dimitri

dimitri_c
November 23rd, 2006, 02:58 PM
Sorry…

Could someone explain me:
Woud you mind to explain me a little more:
"Come to think of it, your "this" error sounds like you using a class that extends a movieclip, but are not referencing it in the Linkage Properties."?

Thank you…


- Dimitri

DavidOrtiz
March 10th, 2007, 06:21 PM
i've got an image of 600 x 400 where im running perlin noise on it based on a Point Object where my x constantly changes.

imagine a giant flag blowing in the wind. that's the effect im doing, but the price is 100% cpu usage since im running it in an OnEnterFrame.

any ideas how to fix this?