terça-feira, 14 de agosto de 2007

Flash Loop on Ocean animation Tutorial - Flash Wave ocean agua


Flash Loop on Ocean animation Tutorial




Required Flash version: MX or higher, I’ll be using flash 8.
Prerequisites: Masking through actionscript, motion tweening.



This tutorial discusses a simple yet very effective technique used mostly in animating water reflections or large water surfaces such as the ocean.
I will walk you through the steps of animating a picture of the ocean using simple actionscript as we’ll only use the setMask method together with a simple seamless motion tween.



To make you have a better understand on this tutorial, check the flash animated ocean below. This is what we are going to make by the end of this tutorial.

src="http://cambodiaxp.com/flash_kits/tutorial_kits/23/ocean-flash-loop.swf"
align="middle" menu="false" quality="high" bgcolor="Transparent"
width="420" height="160" name="index"
type="application/x-shockwave-flash" wmode="transparent"
pluginspage="http://www.macromedia.com/go/getflashplayer"
/>








So fire up your flash IDE and start up a new flash movie, make it 420x260 with a white background.
Start by importing the picture we’ll be animating, it’s a beautiful sunset scene made with a 3D package by me (sunset.jpg).
You’ll have to reduce the image size by 50 percent so that it fits your stage size, in case you don’t know how to do that, here’s a quick how-to:



Select the picture, expand your side panel and click on the Transform tab (if you don't see one, simply press CTLT + T. Check the constrain checkbox and enter 50 % in either the width or the height box and finally hit enter and there you go, your graphic is resized (figure 1).



Figure 1



Center it up so that it fills the entire visible area of the stage, select it and hit F8, you heard me right, F8 that is convert it to a library symbol, we’ll choose a movie clip symbol and we’ll leave the default symbol name of symbol 1 (figure 2).



Figure 2



Now once this preparatory stage is done, we start building the core of the animation, the waves…
The whole effect relies on making the wavy water surface move realistically, for that purpose we’ll need a movie clip and we’ll need to motion tween this clip then assign it as mask that will reveal an underlying picture slightly different than the one we already have on stage.
So let’s start with the easy part, select the first frame in the timeline, right click and choose copy frame, then make a new layer, by default this new layer (layer 2) will be placed above layer 1, right click on the first empty frame of layer 2 and choose paste frame (figure 3).



Figure 3



Now this is very important for the effect, right click on the copy of the image on layer 2, select break apart and then select with your mouse the upper part of the picture, yes everything above the sea and just hit delete to remove it! Then, using the Up arrow key, move the dropped copy of the image on layer 2 few pixels down. To end up with this step, click on the cropped picture and press F8 to convert it to a movie clip, give this movie clip the instance name of masked (Figure 4).





Now for the last part, draw a horizontal line with the line tool, let it be stage wide, change its stroke height to 3 then click the modify menu and choose Modify > Shape > Convert Lines to Fills (figure 5) and then press F8 to convert it to a movie clip. Give it the instance of myMask.



Figure 5



Double click on this movie clip of the horizontal line and once you’re inside its timeline, position it 5 pixels higher than the horizon (of the original image on layer 1) then press and hold the ctrl button on your keyboard and make several copies of the line, let them be 5 pixels away from one another, keep on making copies till you reach the lower end of your stage (figure 6).



Figure 6



Notice that the color of the lines doesn’t matter as it won’t appear at all, only the thickness, the number and the spacing of lines will affect the final visual aspect of the moving waves.



Now, select all the lines (ctrl+A), press F8 and choose movie clip as symbol type. Go to frame 20 on the timeline, right click and choose insert keyframe.
Still on the timeline, click anywhere between frame 1 and 20 and from the properties panel choose motion tween. Now move the playhead to frame 20, select the lines on the stage and nudge them down a few pixels with the Down arrow key.



The last thing we’re going to do is to assign the moving lines as a mask to the masked movie clip, this is where the effect really comes together.
So go up one level, back to the main timeline, make a new layer, rename it to actions and lock it so you wouldn’t accidently place any content on it (it’s always a good idea to separate design from code), on the first frame on this actions layer, right click and choose Actions then type this simple line of code:








That’s it! Our effect is now ready for testing. Hit ctrl+Enter and enjoy the soft waves of this virtual ocean.






Last thoughts:

Well to end up this tutorial, I would like to explain a bit the single line of code we used to achieve the masking effect.



The setMask method of the MovieClip class assigns a movie clip as mask for another, in our case the “myMask “ was the mask and the “masked” was the movie clip masked by it. This masking allows us to see the masked movie clip only through the filled areas of the mask (and that’s why we converted lines to fills) whereas the non-filled space in between the lines will remain perfectly transparent thus allowing us to see the original ocean image through it. Since the cropped image is slightly shifted, the movement of the mask movie clip gives the illusion of small waves on the surface of the ocean.



Further experimentation:

Try to reduce the distance between the lines or even making the lines a bit curved and see what impact would that have on the visual effect.
You might also want to explore the new bitmapData methods, they offer some noise filters that would greatly enhance what was achieved till now.



Finally, If you feel like spending some few buck, you may wanna check out the flash loop collection from FlashTrue.com







segunda-feira, 13 de agosto de 2007

Magic image effect in flash / Efeito mágico da imagem no flash







In this lesson you have a chance to learn how to create very modern and useful image effect in flash in few steps, using the Gradient Bevel flash filter. You don't have to use A.S. code to create this lesson.



Step 1



First of all, find any image that you want to use for this tutorial.



Step 2



Open a new flash document.



Step 3



Choose File > Import > Import to Stage (Shortcut key: Ctrl+R) and import any image into a flash.



Step 4



While the image is still selected, press F8 key (Convert to Symbol) to convert that image into a Movie Clip Symbol.







Step 5



Click on frame 5,25 and 30 and press F6 key. After that, go back on frame 5, take the Selection Tool (V) and click once on the image to select it. Then, go to the Properties Panel (Ctrl+F3) below the stage and click on Filters tab. After that, click on the plus icon and select Gradient Bevel filter. Make the adjustements as the picture below shows you.







Do that also for frame 25.



Step 6



Right-click anywhere on the gray area between the frame 1 and frame 5 and frame 25 and 30 on the timeline and choose Create Motion Tween from the menu that appears. See the picture below.







Step 7



Press Ctrl+J key (Document Properties) and for Frame Rate set 28fps (Frames per Second).







We're done!



Test your Movie (Ctrl+Enter).



Enjoy!


download here File

====================================================================================
Tradução

Nesta lição você tem uma possibilidade aprender como criar o efeito muito moderno e útil da imagem no flash em poucas etapas, usando o filtro do flash do chanfro do Gradient. Você não tem que usar o código de A.S. criar esta lição.









Etapa 1



Primeiramente de tudo, encontrar toda a imagem que você quiser usar para este tutorial.



Etapa 2



Abrir um original flash novo.



Etapa 3



Escolher a lima > a importação > a importação a encenar (chave de atalho: Ctrl+R) e importam toda a imagem em um flash.



Etapa 4



Quando a imagem for selecionada ainda, pressionar a chave F8 (converso ao símbolo) para converter essa imagem em um símbolo do grampo do filme.







Etapa 5



Estalar sobre o frame 5.25 e 30 e pressionar a chave F6. Após o esse, ir para trás no frame 5, fazem exame da ferramenta da seleção (V) e do clique uma vez na imagem para selecioná-la. Então, ir ao painel das propriedades (Ctrl+F3) abaixo do estágio e estalar filtra sobre a aba. Após o esse, estalar sobre o ícone positivo e selecionar o filtro chanfrado do Gradient. Fazê-lo aos adjustements como o retrato abaixo das mostras.







Fazer isso também para o frame 25.



Etapa 6



o Direito-clique em qualquer lugar na área cinzenta entre o frame 1 e o frame 5 e o frame 25 e 30 no timeline e escolhe cría o Tween do movimento do menu que aparece. Ver o retrato abaixo.







Etapa 7



Pressionar a chave de Ctrl+J (propriedades do original) e para a taxa 28fps ajustado do quadro (quadros por o segundo).







Nós somos feitos!



Testar seu filme (Ctrl+Enter).



Apreciar!

quinta-feira, 9 de agosto de 2007

Flash Digital Clock

Using this little tutorial, you will see how to create simple digital clock in flash using a little action script code.You can use this digital clock for any web site if you like.You will also learn how to design a area for clock, how to create dynamic text field and more.Let's go!







Step 1



Create a new flash doucment.Take the Rectangle Tool (R). In the Colors portion of the Tool panel, block the Stroke color by clicking on the little pencil icon and then on the small square with the red diagonal line. For Fill color choose #19A3CB color and draw a "rectangle" about 180x55px.



Step 2



While the rectangle is still selected, go to the Align Panel (Ctrl+K) and set the following options:



1.Make sure that the Align/Distribute to Stage button is turned on,

2.Click on the Align horizontal center button and

3.Click the Align vertical center button.







Step 3



Take agian the Rectangle Tool (R) and repeat step 1, but for this time, for Fill Color choose #2379CF. Then, draw the another rectangle within the first rectangle about 140x30px. See the picture below.







After you have drawn the second rectangle within the first rectangle, repeat step 2 to align also the second rectangle with the background.



Step 4



Double click on layer 1 to rename its name in background.



Step 5



Then, click on the seconda frame of layer background and press F5 key. After that, create a new layer above the backround layer and name it dynamic text. See the picture below.







Step 6



Select the dynamic text layer and take the Text Tool (A).Then, create a dynamic text field over the white rectangle. See the picture below.







Step 7



While the dynamic text field that we just created is still selected, go to the Properties Panel (Ctrl+F3) below the stage. On the left side, You will find the Instance name input field there. Call this dynamic field Clock_text.







Step 8



Create a new layer above the dynamic text layer and name it action.



Step 9



Click on the first frame of layer action and open the Action Script Panel (F9). Then, enter the following code inside the actions panel:



time=new Date(); // time object

var seconds = time.getSeconds()

var minutes = time.getMinutes()

var hours = time.getHours()

if (hours<12) {

ampm = "AM";

}

else{

ampm = "PM";

}

while(hours >12){

hours = hours - 12;

}

if(hours<10)

{

hours = "0" + hours;

}

if(minutes<10)

{

minutes = "0" + minutes;

}

if(seconds<10)

{

seconds = "0" + seconds;

}

Clock_text.text = hours + ":" + minutes + ":" + seconds +" "+ ampm;



Step 10



Click on the second frame of layer action and press F6 key. Then, enter this code inside the actions panel:



gotoAndPlay(1);



Test your Movie (Ctrl+Enter).



We're done!