Using Flash to realize the effect of moving shape and changing shadow

Source: Internet
Author: User

screen, often can see the warrior "swish" to the left Flash, "swish" to the right flash, and then flash to the roof or treetops, and then "swish" to disappear in the moon. This effect has occurred in many flash works. So, how exactly is this effect designed? In fact, this "phantom" effect (see Preview) can be done using the copy function of Flash and several basic movie properties as well as some simple control statements. So, as long as there is a little programming basis, it can be done to design this effect.

Figure 1 Effect Preview chart

Open the Flash MX. Set the scene size to pxx450 px, white background, frame rate of 12fps. If the plot needs, you can change the frame rate to match the animation of the playback rhythm.

I. Design of components

1. Making people

Press the shortcut key Ctrl+f8 to create a new graphic symbol named "character." Press the shortcut key ctrl+r to import a picture of the person. such as the cartoon picture in the effect preview chart.

2. Making People Videos

Press the shortcut key Ctrl+f8 to create a new movie clip symbol named "People movie." There is only one layer of the "People movie" symbol, which is the composition of the frame as shown in Figure 2. The "People" layer design method is as follows:

Figure 2 Structure chart of the character movie symbol

Press shortcut key Ctrl+l Open the library, the graphic symbol in the library "characters" dragged to the "people" layer. Then right click on the 1th frame of the layer, select Create Motion Tween command, build the frame of the gradient movement. The gradual movement of the 1th frame can be dispensed with after repeated work.

As shown in Figure 2, click 4th, 8, 12, 16, respectively ... 60 frames, press shortcut key F6 insert keyframes. Then the cartoon pictures in each frame to move the position, so that it is more dynamic when the movement can be. However, frame 60th is set to be the same as frame 1th to ensure that the movie will play smoothly.

Second, the design scene

1. Design character film Layer

Change the name of the "Layer 1" layer in the scene to the "MovieClip" layer, as shown in Figure 3. Then the "character movie" symbol from the library dragged the scene, click on the 1th frame of the layer press F5 to insert a frame. Select "Character movie" in the "MovieClip" layer and give it an entity name "Follow0". As shown in Figure 4.

Figure 3 Effects of all layers and their structure

Figure 4 giving the "People movie" an entity name

2. Design Script Layer

Click the Insert Layer button to create a new "Actions" layer, then select Frame 2nd in the layer and press the F7 key to insert the blank keyframe. Press F9 to open the Actions panel and enter the following code for each of the two frames.

The code in frame 1th is as follows:

i = 1; The unique depth level of the copied movie clip. is the stacking order of the copied movie clips.

Maxnum = 10; Control variable with the maximum number of copies of the movie

The code in frame 2nd is as follows:

while (i <= maxlight) {

Copy movie clip "Follow0"

Duplicatemovieclip ("Follow0", "Follow" add I, I);

Scales the movie to a certain percentage, and when the movie moves, the copied film becomes The Phantom.

this["Follow" add I]._xscale = this["Follow" add I]._xscale + i;

Scales a character movie by a certain percentage in the direction of the Y axis

this["Follow" add I]._yscale = this["Follow" add I]._yscale + i;

Set the transparency of a movie

this["Follow" add i]._alpha = i;

i++;

}

Stop (); Let the movie stop playing on frame 2nd,

Ah, it's done. The "phantom" Dafa came here to "cultivate" it. Test it. I believe this "mirage" will greatly add to your flash work, so that you face the full. In addition, you can change the motion speed and direction of the effect by adding some motion references in the scene. This is like designing a racing game, we just use the high-speed movement of the black and white squares to let the players produce the illusion of the car racing.

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.