Flash as make up bubble effect animation

Source: Internet
Author: User
Tags copy eval

Effect Demo:

Click here to download the source file

If one is a painting, the workload is heavy and the effect is not good. We use the copy statement of as as the number of blisters, the use of setting properties to change the transparency, size and so on. Finally, set the blisters in the movie clip left and right swing. This combination, you can achieve the effect of bubble rise.

Specific steps

1, open MX create a new document. and modify the document properties appropriately (400x300, blue background)

2, build a movie clip, named "H2O". After entering the editor, use the drawing tool to draw a blister with the gradient fill. As shown in Figure 1.

Figure 1 Drawing blisters

3, back to the main scene, the layer 1 named "H2O." Drag the "H2O" movie clip from the library to the bottom of the scene, and name it "H2O" in the following property panel. As shown in Figure 2.

Figure 2 Layer "H2O"

4, create a new layer in the main scene, named as. In frame 1th Add as:

I=1
while (i<=30) {
Duplicatemovieclip ("H2O", "H2O" +i,i);
SetProperty ("H2O" +i,_x,random (400));
SetProperty ("H2O" +i,_y,random (100) +300);
SetProperty ("H2O" +i,_xscale,random (60) +40);
SetProperty ("H2O" +i,_yscale,getproperty (eval ("H2O" +i), _xscale));
SetProperty ("H2O" +i,_alpha,random (30) +70);
i++
}
_root.h2o._visible=0

5, the specific explanations are as follows:

I=1//initialization variables
while (i<=30) {//To control the amount of water droplets
Duplicatemovieclip ("H2O", "H2O" +i,i); Copy water droplets
SetProperty ("H2O" +i,_x,random (400)); Randomly distributed droplets on the x axis
SetProperty ("H2O" +i,_y,random (100) +300); Ditto, just replaced by the Y axis
SetProperty ("H2O" +i,_xscale,random (60) +40);
SetProperty ("H2O" +i,_yscale,getproperty (eval ("H2O" +i), _xscale));
The above two as is used to control the size of water droplets.
SetProperty ("H2O" +i,_alpha,random (30) +70);/To control the transparency of water droplets
i++
}
_root.h2o._visible=0//Hide the water droplets from the main scene.

6, select the movie clip "H2O" and add as:

Onclipevent (load) {
Speed = random (5) +3;
}
Onclipevent (enterframe) {
This._y-= speed;
This._x + = random (3)-random (3);
if (this._y<-15) {
this._y = random (100) +315;
}
}

7, the AS statement above means:

Onclipevent (load) {//To randomly assign to the speed of water droplets, Jean movement more realistic.
Speed = random (5) +3;
}
Onclipevent (enterframe) {
This._y-= speed; To change the coordinates of the y-axis of the water droplets so that we look like the droplets are constantly rising.
This._x + = random (3)-random (3); For the Pearl movement in Sheung Shui is more realistic, we are shaking around the water bead.
The IF (this._y<-15) {//This if statement is to be put back into the screen when the drops are removed from the screen.
this._y = random (100) +315;
}
}

8, Save the test!





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.