Oct 13, 2007

Creating photorealistic waves in Flash.

Flash Tutorial

click on images to see their original size

PHOTOREALISTIC FLASH WAVES PREVIEW IS HERE!


Let’s start with taking a picture of sunset, like this one:




Save it as a sky.jpg

After that, open it in photoshop, and go to Edit – Transform > Flip vertical. Save this image as a “water”




Each of our two images is 406x172 px,.

Now, open Flash, and create a new document 400x330 px.




Press Ctrl+R (import), and import a sky.jpg file. Plase it in the upper part of our document, make sure it is selected, press F8 to make it movie clip, name it sky_mc.




Create new layer, press again Ctrl+R, import water.jpg file, place it under “sky” picture, also convert it to movie clip, and name it as a water_mc. Put the layer under the sky layer.




Create new layer, out of document draw a rectangle (400 px with) and paint it with a gradient from white to black. Make sure it is selected, press F8 to convert it to movie clip and name it as a gradient_mc.




Now click on each image, and check their names here:





After that, create a new layer, press F9, and in the window that appeared – paste this script.



var w = water_mc._width;
trace(w);
var h = water_mc._height;
ripple = new flash.display.BitmapData(w, h);
ripple3 = new flash.display.BitmapData(w, h / 2);
ripple2 = new flash.display.BitmapData(w, h / 4);
ripple1 = new flash.display.BitmapData(w, h / 4);
gradient = new flash.display.BitmapData(ripple.width, ripple.height);
gradient.draw(gradient_mc, new flash.geom.Matrix(1, 0, 0, 1, 0, 0));
gradient_mc._visible = false;
offset3 = new flash.geom.Point(0, 0);
offset2 = new flash.geom.Point(0, 0);
offset1 = new flash.geom.Point(0, 0);
speed1 = -0.300000;
speed2 = -0.600000;
speed3 = -1.200000;
pt = new flash.geom.Point(0, 0);
rect = new flash.geom.Rectangle(0, 0, ripple.width, ripple.height);
this.onEnterFrame = function ()
{
offset1.y = offset1.y + speed1;
offset2.y = offset2.y + speed2;
offset3.y = offset3.y + speed3;
ripple3.perlinNoise(0, 15, 1, seed, true, true, 1, true, [offset3]);
ripple2.perlinNoise(0, 10, 1, seed, true, true, 1, true, [offset2]);
ripple1.perlinNoise(0, 5, 1, seed, true, true, 1, true, [offset1]);
ripple.copyPixels(ripple1, r1rect, r1pt);
ripple.copyPixels(ripple2, r2rect, r2pt);
ripple.copyPixels(ripple3, r3rect, r3pt);
ripple.merge(gradient, rect, pt2, 127, 127, 127);
dMap = new flash.filters.DisplacementMapFilter(ripple, pt, null, 1, 100, 100, "WRAP");
water_mc.filters = [dMap];
};
r1rect = new flash.geom.Rectangle(0, 0, ripple1.width, ripple1.height);
r2rect = new flash.geom.Rectangle(0, 0, ripple2.width, ripple2.height);
r3rect = new flash.geom.Rectangle(0, 0, ripple3.width, ripple3.height);
r1pt = new flash.geom.Point(0, 0);
r2pt = new flash.geom.Point(0, ripple1.height);
r3pt = new flash.geom.Point(0, ripple1.height + ripple2.height);

That’s it!!!

PHOTOREALISTIC FLASH WAVES PREVIEW IS HERE!

You can download an original *.fla file with layers here.


Copyright © http://megatutorials.blogspot.com

AddThis Social Bookmark Button

43 comments:

Anonymous said...

thanks!

Anonymous said...

wow! nice! but why doesnt the code work with other sizes? i created an excact copy but skyscraper sizes and it didnt work :(

Sorin David Otelariu said...

nice job. but what if sky_mc and water_mc don't have the same hight?!

Anonymous said...

i dont see any effect when i play it.
it shows me 400 in the output popup window.

Anonymous said...

Did not work for me.

Efendi said...

brilliant !

Anonymous said...

An awesome tutorial. Really love it.

Anonymous said...

Its fun. fantastic-Rishi

Anonymous said...

come back and explain the code. then most peoples problems might be solved. great result tho!

Anonymous said...

you really should explain the code...

Anonymous said...

It is really amazing looking cool great job

ramzaghi said...

it was awesome but there appeared a 406.5 warning in the output popup window :)

ramzaghi said...

it was awesome but there appeared a 406.5 warning in the output popup window :)

ramzaghi said...

it was awesome but there appeared a 406.5 warning in the output popup window :)

ramzaghi said...

it was awesome but there appeared a 406.5 warning in the output popup window :)

ramzaghi said...

it was awesome but there appeared a 406.5 warning in the output popup window :)

ramzaghi said...

it was awesome but there appeared a 406.5 warning in the output popup window :)

Anonymous said...

i dont see any effect when i play it.
it shows me 406 in the output popup window.

Unknown said...

Awesome!!!!!! I failed the first time . i tried again and it worked! Cool As!!! But 406 kept coming in the output.

Anonymous said...

Hello,

I am contacting you on behalf of www.flashcomponents.net . I've read one of your tutorials and I like the way you write. Our site is continuously growing and we recently added a tutorial section. We kindly ask for your approval to allow us to publish your tutorials on our site, mentioning you as the author.
Of course, we are inviting you to do it yourself, but either way, it would be our pleasure to publish them.

Kind regards,
Mike | Flash Components Team
Mail: flashcomponents@hotmail.com

Calliope said...

It is a smart nice effect indeed! However

1) I see people commenting without the writer ever replying to them, is he there,has he forgotten about his tutorial?!

2)at least two more standard sizes would make the tutorial more efficient. Or maybe tell us how to change the AS code for that?

3)no commenting in AS whatsoever, how are we to understand it's sections without puzzling ourselves?

Anonymous said...

To solve that Problem, which makes Flash Movie do not run like Sample, you have to create a new project in Actionscript 2.0, not Actionscript 3.0, at the beginning of your Work.

Have fun!

Anonymous said...

This looks nice but can this be made in AS3 as well?

electric ufo said...

to answer some of your questions:

resizing it depends on your gradient and matrix. the matrix can resize it, but for an easy way, just make the gradient square wider than your document.

do this for the shape of the square and not the movieclip.



also, when you get an 'error message' its actually because of the second line that says "trace(w);". this line does not affect your document, it just give you the output of your width. you can erase it completely.

finally, no this does not work for AS3

Anonymous said...

It gives some serious cpu usage if used in larger movies and higher frame rate. Can anyone explain how to optimize it at least for 35frames/sec?

Nice tutorial, but code could be explained. I wasn;t able to make any difference on CPU load except by lowering frame rate.

Liff Eyewear said...

Sorry for non replying you guys. Well, once in my work i had to do such flash animation, so i asked my friend to tell me how it can be done. He sad that code is complicated, and just gave me this code. After i checked it, and saw that it is working, i wanted to share it, in case some one will need it.

Anonymous said...

アダルトサイト
人気アダルトサイト
優良アダルトサイト
アダルト
アダルトビデオ
人気アダルトビデオ
AV
人気AV
無修正
無修正サイト
無修正動画
無修正動画サイト
人気無修正動画サイト
優良無修正動画サイト
無料動画
無料動画サイト
人気無料動画サイト
優良無料動画サイト
無料画像
無料画像サイト
人気無料画像サイト
優良無料画像サイト
海外動画
AV女優
人気AV女優
ポルノ
人気ポルノ
ポルノ女優
人気ポルノ女優
PORNO
素人
熟女
陵辱
SM
JK
女子校生
スカトロ
盗撮

Anonymous said...

コスプレ画像サンタ衣装

Anonymous said...

情趣內褲,丁字褲,SM,

震動環,潤滑液,情趣禮物,情趣玩具,威而柔,精油,逼真按摩棒,數位按摩棒,
情人節禮物,情人趣味用品珠,情人趣味用品
情人趣味用品愛蜜莉,情人趣味用品液
情人趣味用品轉,情人趣味用品娃,

G點,按摩棒,轉珠按摩棒,變頻跳蛋,跳蛋,無線跳蛋,

飛機杯,男用強精長軟質套,男用強精短軟質套,充氣娃娃性感內褲,
自慰套,自慰套,情趣娃娃,自慰器,電動自慰器,充氣娃娃,
情趣,情趣用品,巴黎,

kitty said...

Hello, wonderful blog!thank you. By the way,here we offer a lot of good nike shoes,you can come to have a

look.
nike tn
nike shoes
nike chaussures
nike shox
nike shox
achat nike tn
tn chaussures
nike air max
nike femme chaussres
femmes chaussres
cheap ugg
uggs
homme chaussures
nike shox requin
nike homme chaussures
puma

ducati

men's nike shoes
nike shox monster
nike store
cheap ugg
puma
puma chaussures
nike shoes sell
nike air max
nike shox
cheap nike shoes
cheap uggs
nike shoes
puma shoes
enfant chaussures
tn requin
enfant chaussures
nike shox
nike chaussures
achat nike shox r4
nike shox r4
nike monster
discount nike
monster fr

trustme said...

Hello, wonderful blog!thank you. By the way,here we offer a lot of good nike shoes,you can come to have

a look.
nike tn
nike shoes
nike chaussures
nike shox
tn chaussures
nike tn
tn chaussures
nike air max
sneakers
shox oz
nike air rift
nike shox monster
nouvelle nike shox
nike shox rival
nike air max 360
men's nike shoes
nike shox monster
nike store
puma
puma chaussures
nike shox r4
nike air max
achat nike shox
cheap nike shoes
nike tn
tn chaussures
nike air max
enfant chaussures
nike tn requin
nike tn
junior chaussures
chaussures nike shox
acheter chaussures homme
tn chaussures
chaussures sport
nike air jordan
nike air max tn

lovebaby said...

優良出会い系
巨乳人妻出会い系
割切った 出会い
巨乳ギャル出会い系
素人ギャル 出会い系
家出娘出会い系サイト
巨乳出会い系サイト
デリヘル嬢出会い系
ぽちゃ 出会い
デブ出会い系
人妻 出会い
必ずやれる 出会い系
学生 出会い系
やれる 出会い
セクキャバ嬢出会い系サイト
エロ系出会い系
セク友出会い系サイト
キャバクラ嬢 出会い系
即アポ 出会い系
巨乳ギャル出会い系
家出娘 出会い系
援助交際出会い系サイト
風俗嬢 出会い
巨乳出会い系

ハリソン said...

you know評判管理?

ie2.6

Nile said...

やらしいロリ出逢い淫乱JK即ハメ出会いセックスフレンド学生即ハメ出会いSEX好きJK出合いエッチ女子高校生無料出会い系援助交際10代出会い掲示板割り切ったJK無料出会い系割り切ったロリと出会えるセフレJK出会いBBSドMロリと出会える割り切った女子高生と出会い割切り女子校生出会い系サイト

Anonymous said...

AirMax BW|AirMax Huarache|AirMax LTD |AirMax Skyline |AirMax TN
AirMax Zength|AirMax 09 Sneakers|AirMax 180|AirMax 2003|AirMax 2006|AirMax 2009|AirMax 2010|AirMax 360 |AirMax 87|AirMax 90|AirMax 91|AirMax 92|AirMax 93|AirMax 95|cheap ugg boots|discount ugg boots|ugg boots|classic ugg boots|ugg classic tall boots|Dior sunglasses|Ray Ban sunglasses|Fendi Handbags|Hermes handbags|Miu miu Handbags|Timberland Boots|timberland outlet|Moncler Jackets|Moncler coats|discount Moncler Vest|Moncler outlet|moncler polo t-shirt

Kitty said...

ドM新妻即アポ出会い ★ エッチ好き新妻出合い ★ 淫乱人妻と出会い ★ セフレ希望40代即ハメ出会い ★ SM好き40代出合い ★ 巨乳40代出会い無料 ★ 巨乳新妻即エッチ出会い ★ エッチな30代完全無料出会い ★ やれるギャル系人妻出合い ★ エッチ好き若妻無料出会い系 ★ やれる主婦即ハメ出会い ★ 巨乳30代掲示板 ★ 巨乳人妻と出会い ★ 巨乳新妻出合い ★ セフレ募集中新妻掲示板 ★ 淫乱主婦即ハメ出会い ★ エッチな40代出会い系サイト ★ やれるギャル系人妻出会い系無料 ★ 浮気人妻出会い ★ エッチなギャル妻出会い掲示板 ★ 愛人募集30代出会い系 ★ 巨乳人妻とやれる ★ 巨乳ギャル系人妻無料出会い系 ★ ドエム人妻出会い掲示板 ★ やりまん奥さん無料出会い系 ★ 近所の奥さん即アポ出会い ★ 淫乱主婦出会い系無料 ★ ドエムギャル妻とやれる出会い系 ★ 

cyshuqian said...

glass bottle
power strip
extension cord
extension cord
power socket
glue gun
Power strip
booster cable
tow rope
ratchet tiedown
power sockets
extension cords
power strips
glue gun
glue stick
trouble light
booster cable
power cord
Power Strip
Extension Cord
glue gun
hot glue gun
booster cable
battery clip
power strips
booster cable
extension cords
booster cables
battery clip
tow rope
ratchet tie dowm
Speaker Cable Power cable
Power cable
Speaker Cable
Optical Fiber Cable
cosmetic packaging
makeup brushes
hair rollers
make up brushes
straightening machine
drawing machine
Bucket Teeth
hair accessories
folding bike
children bikes
mountain bike

combattery84 said...

Dell HD438 Battery
Dell GK479 battery
Dell PC764 battery
Dell KD476 Battery
Dell Inspiron 1150 battery
Dell inspiron 8500 battery
Dell Inspiron 4100 battery
Dell Inspiron 4000 battery
Dell Inspiron 8200 battery
Dell FK890 battery
Dell Inspiron 1721 battery
Dell Inspiron 1300 Battery
Dell Inspiron 1520 Battery


Dell Latitude D600 Battery
Dell XPS M1330 battery
DELL XPS M1730 Battery
Dell Latitude D531N Battery
Dell INSPIRON 6000 battery
Dell INSPIRON 6400 Battery
Dell Inspiron 9300 battery
Dell INSPIRON 9400 Battery
Dell INSPIRON e1505 battery
Dell INSPIRON 2500 battery
Dell INSPIRON 630m battery
Dell Latitude D820 battery
Dell Latitude D610 Battery
Dell Latitude D620 battery
Dell Latitude D630 battery
Dell xps m1210 battery
Dell e1705 battery

Kitty said...

子持ち主婦に人気の高収入メールレディーはとてもよろしいと思いました。→旦那に内緒で稼げる 携帯アルバイトはとてもよろしいと思いました。優良情報が見放題片手間でも1日5000円以上稼げるを楽しんでね。優良モバイルサイト育児中の主婦に人気の高収入チャットレディーがイイよ、某掲示板でも評判のOL・主婦でも安全 チャットレディーに今すぐGO~★女性に人気の高収入チャットレディーを楽しんでね。ココ→専業主婦でも月60万以上稼げるだね^^すごい主婦でも月60万以上稼げるを参考に★主婦・人妻に人気の高収入メールレディーを参考に人気の学生に人気の携帯メールレディにいこう。イイ情報がたくさんの顔出し無しでも稼げる携帯ライブチャットレディーにいこう。人気サイト職歴不問☆稼げる携帯チャットレディーを参考にしてみてね★★女性 高収入チャットレディー求人募集は見ました?素敵な彼に内緒で稼げる メールレディーが参考になりました♪マル秘サイトノルマ無し☆稼げる携帯メールレディーが1番良かったです!!マル秘情報満載会話だけ 稼ぎやすいチャトレ が良いみたいです。皆さんにお勧めしたい1日1万以上のチャットレディーがいい感じ、優良情報満載自由な時間に稼げる携帯チャットレディーがイイよ、口コミで大人気のエッチ無し 稼ぎやすいチャトレ がイイよ、マル秘情報満載外出中でも稼げる携帯チャットレディーで幸せになれた○人気のすぐにお金が貰える 携帯チャットレディーは楽しいね。大人気主婦でも時給4000円以上稼げるはとてもよろしいと思いました。人気モバイルサイトOL・主婦でも1日2万以上稼げるに移動、本物の女性 高収入チャットレディー求人募集です。

Kitty said...
This comment has been removed by the author.
love shopping said...

jimmy black shoes
jimmy choo sandals
jimmy choo high
jimmy choo pumps
jimmy choo wedding shoes
buty jimmy choo
jimmy choo skor
jimmy choo booties
shopping jimmy choo
my jimmy choos
jimmy choos heels
DISCOUNT JIMMY CHOO
jimmy choo handbags
JIMMY CHOO

jimmychooshoes said...

Christian Louboutin Miss 120 platform ankle boots |Christian Louboutin Miss 120 platform ankle boots
Christian Louboutin Miss Clichy 120 boots |Christian Louboutin Miss Clichy 120 boots
Christian Louboutin Miss Corset Lace-Up Ankle Boot |Christian Louboutin Miss Corset Lace-Up Ankle Boot
Giuseppe Zanotti Balmain Multi Buckle Leather Boots |Giuseppe Zanotti Balmain Multi Buckle Leather Boots
Alexander McQueen Faithful Bootie |Alexander McQueen Faithful Bootie

Quincy said...

您好 與您一起分享有關於黃金回收的
黃金回收價格
如有任何黃金回收請找台北專業黃金回收宏鑫貴金屬
謝謝