Flash animation to make lightning effects

Source: Internet
Author: User

How to use as to make lightning effects?

Solution ideas (must have)

Form the shape of lightning by copying the x-axis, y-axis coordinates of the movie clip. Then use random to randomly set the position of lightning.

Specific steps (must have)

1, run Flash MX, set document properties, background is black.

2, create a new movie clip, named "Guo". Enter the edit area to draw a gradient filled rectangle. The gradient fill on both sides of the rectangle is transparent, which can be a better fusion of black skies. As shown in Figure 1.

Figure 1: Drawing the movie clip "Guo"

3, create a new movie clip named "Guoy" and Place "Guo" in it. Make a blink effect. Flashing effect is nothing more than transparency and brightness of the high and low, we use the method of transparency and production. As shown in Figure 2.

Figure 2: Making flashing effects

4, Lightning Flash, the sky is not still to flash that? Yes, similarly, make a white rectangle, pull the tower into the main scene, as in the second step, adjust its gradient, it is important to be careful with the film clip Guoy in the blink, guoy transparency must be with the sky flashing transparency to meet. We set the fifth frame transparency to 20%. Others are shown in Figure 3.

Figure 3: Sky Blink effect

5, create a new layer in the main scene, drag "Guoy" from the library to the top of the scene, and extend to frame 11th. Select the movie clip "Guoy" and name "Guoy" in the Properties panel. As shown in Figure 4.

Figure 4: Naming a movie clip

6, first build a layer as. Add the following code to frame 1th:

i = 1;//initialization variable is useful below.
SetProperty (_root.guoy, _visible, false);//Set the original MC is not visible.
j = 100+number (random (300));//initialize variable, useful below.
Max = random (n);//guoy list the most numerous
dis_x = Random (3) -1;//Two of the Guoy listed together are staggered in the x direction.
Insert a blank keyframe in frame 2nd and add the code:
while (number (i) <number (Max))///When the copied Guoy is less than 350
{
i + = 1;//i from Add 1
_root.attachmovie ("Guoy", "Guoy" add I, I);//Connect Guoy to Guoy+i, level I.
SetProperty ("Guoy" Add I, _y, i); the y-coordinate of the MC with Guoy+i is I, two copies of the GUOYY coordinates differ by 1 for easy connection.
distans_x = Number (random (5)-2) +number (dis_x);//Two The y-coordinate of the difference between Guoy
J + + number (distans_x);//j self-added
SetProperty ("Guoy" Add I, _x, j);/set properties, needless to say.
SetProperty ("Guoy" Add I, _xscale, max-i);//Reduce the length of the copied guoyx direction with I increase.
}
while (number (i) <350) {
i = number (i) +1;
Removemovieclip ("Guoy" add i)////When the copied Guoy is less than 350, clear in time
Previously copied Guoy lest, this time the lightning appeared last peripheral.
}

7, save, Test.

Click here to download the source file



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.