Flash teaches you how to make flames follow the mouse

Source: Internet
Author: User

This example explains the use of the as code to make mouse follow the effect, let the flames follow your mouse to render beautiful graphics bar!

Effect Demo:

Now start making:

Create a new flash document with black background color and other defaults. First to paint the flames: New graphic components, named: "Flame", with an elliptical tool without filling, draw an oval, as shown:

Then with the selection tool, adjust to the following diagram shape:

The figure is curved and recessed a bit. It must be so.

With a radial fill, select the color in the following figure, noting that the rightmost color label has zero transparency. Create a new layer and pull it below the first layer: Draw a garden with an elliptical tool, without a border, with a light red color, a left color standard of 20%, and a right color standard transparency of 0%. After the painting with the fill deformation tool adjustment, according to the picture put well.

Note: After the flame is filled, with the fill deformation tool, the fill center point is transferred to the flame part, as shown in figure:

Create a new movie clip symbol named: "Smoke". Insert 7 keyframes Frame by frame, fill with radiation, the left and right color mark are white, the color of the mark is 20%, the transparency of the color is 0%, the figure of each frame is as follows: (click Small picture to see big picture)

Then: Open the onion skin tool, so that 7 frames are visible, adjust the 7 frame graphics position, into the following shape.

Next, create a film clip element called a flashing flame. Drag the flame component into, and insert the keyframe at frame 2nd. In frame 2nd, select the Flame component, point "modify"-"transform"-"flip horizontally". Locked. Insert new layer, draw a no strokes, yellow radiation fill, left color standard transparency 80%, right color standard transparency 50%, the Oval garden, placed in the lower part of the flame. As shown in figure:

Insert frames in frame 2nd, locked. Insert a new layer, drag the smoke components into the flames, put the frame 2nd frame, locked. Now go back to the main scene, drag the flashing flames into the scene and place them anywhere. Open the Properties panel and name the symbol: HM_MC. Then, in frame 3rd, insert the frame and lock it. Insert a new layer named: Action, in frame 1th, open the Action panel and enter the following code:

vari=1;//declares a variable i, which is useful later. hm_mc._visible=false;//make the flame element invisible. In frame 2nd, insert the key frame and enter the following code: if (i<7) {//Will copy 7 Flames hm_mc.duplicatemovieclip ("HM" +i,i);/Copy Flame Fzhm=eval ("HM" +i); Get the name of the new clone flame Fzhm._x=_xmouse+random (5);//Set the X coordinate of the copied flames Fzhm._y=_ymouse-random (5) within 5 pixels to the right of the mouse coordinates fzhm._._ the y-coordinate of the copied flames in 5 pixels above the mouse coordinates. Alpha=random (100);//Set the transparency of the newly copied flame to be random. i++; }else{i=1;//If the flames have been duplicated 7, set I to 1 so that replication can be repeated. Insert the keyframe at frame 3rd and enter the following code: gotoAndPlay (2);

OK, finished, save the test, drag the mouse to see the effect ...

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.