Make beautiful dynamic drops in Flash

Source: Internet
Author: User
Tags copy
Dynamic animation effect:



source File Download >>>>>>


   specific production steps:

First let the water droplets to make the necessary pictures, in fact, they can also refer to the image of their own production



1, before doing this effect, we first need to make a drop of water dripping film clips. Make a drop of water into flash and make a motion tween that drops from small to large.




2, when the water droplets become larger and then let the water droplets slowly drip down below. And let the droplets tremble a few times (using a frame-by-frame animation to make several size changes) when it starts to drip.



3, the next need to make a transparent button (as long as the click Area), the function of the button is to let the mouse on the water droplets on the time let this drop of water drip.




4, finally in the above build a layer, the first frame to write on the frame label "Start", and then add a stop after the drop frame, after the stop frame insert a label for "over" the blank key frame. Function: When the water droplets from the small to stop, so that the water droplets will be displayed on the stage, when the mouse moved to the water droplets will play over the frame after the content, that is, let the water drop.




The following will be the program written.

1, first to write the button on the program, when the mouse is pressed or moved to it above the time to perform a drop of water falling animation

On (release, rollover) {
gotoAndPlay ("over");
}



2, the next thing to write is a key frame with over tags, its function is to get your entire animation has played the time, the unit is Hao seconds. Because even if you do not click the mouse button, after a period of time to let the water drop automatically. Where the radomtime variable is defined in a later program. Its function is to make the time slightly different, so that the water droplets will not fall at the same time.

The procedure is as follows:

StartTime = Gettimer () +8000+radomtime;




Next, make the program on the stage:

1. Drag and drop the movie clip just finished to the stage, and name this instance "Bol". As shown in figure




2, select this instance, press F9 to open the action panel, here to make some initial variable settings. The procedure is as follows:

Onclipevent (load) {
Radomtime = random (5);
Set a variable to control the time gap
StartTime = Gettimer () +8000+radomtime;
Sets a variable that gets the total playback time of the movie, and this variable is about 8 seconds longer than the total duration of the movie playback.
}
Onclipevent (enterframe) {
Timercheck = Starttime-gettimer ();
Control the drop of water droplets with the difference of time between StartTime and video playback.
if (timercheck<=0) {
This.gotoandplay ("over");
}
If the movie is playing longer than the starttime you just acquired, let the water drop.
}



3. The next step is to replicate the instance on the stage. Creates a new layer of code to place the copied instance.




4. The content of the first keyframe is the initial value of the variable I that sets the number of copies.

i = 1;




5, the second frame of the program is mainly used for the replication of the instance. The procedure is as follows:

Radomscale = (Random (4) +2) *26;
Set a variable to control the proportional size of the object after replication.
Duplicatemovieclip ("Bol", "bol" +i, i);
Copy the Bol instance on the stage, naming the newly copied object as "Bol" +i, depth I
SetProperty ("Bol" +i, _x, Random (400));
SetProperty ("Bol" +i, _y, Random (300));
Sets the x and Y coordinates of the newly copied object, using random functions.
SetProperty ("Bol" +i, _xscale, Radomscale);
SetProperty ("Bol" +i, _yscale, Radomscale);
Use the value of the Radomscale variable just set to control the proportional size of the copied object. X, y proportions are the same,
So that the appearance of the water droplets will not deform
i++;



6, the third frame of the program is to control the number of replication objects. The procedure is as follows:

if (i<=15) {
gotoAndPlay (2);//If the number of objects is not 15, return to the second frame to continue copying.
} else {
Stop ()//If the number of copies is 15 or more, the copy is stopped.
}


Finally press CTRL + ENTER for testing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.