Flash Highlights Example Tutorial: Firefly Special Effects

Source: Internet
Author: User
Tags copy
Tutorial | Effects animations are as follows:

Click here to download the source file

One, a new flash document, the background is black, size 800*600.

Two

1. Press O use the Ellipse tool, hold down SHIFT and drag to draw a borderless circle on the stage.
2, open the "color mixer", with "radioactive" fill, as shown:


Third, select the circle, according to F8 into components, behavior: Film clips, that is, the circle into the MC, and named "Worms."
Four, select the home scene 1th frame, open the action panel, write As:for (i=1;i<=20;i++) {//cycle, 20 to copy the number of "worms."
Worm. Duplicatemovieclip ("worm" +i,i);//Copy 20 worms.
With (this["worm" +i]) {
_x = random (stage.width);//stage.width is the stage width.
_y = random (stage.height);//stage.height for stage height.
}//Let the worms spread in every corner of the stage.
}

Select the "Bug" MC, open the Action panel, write:

Onclipevent (load) {
v = 3;//Speed
_rotation = random (360);//Let the worm rotate to any angle.
}
Onclipevent (enterframe) {
K = Math.pow ( -1,random (2));//randomly generate 1 and-1.
_rotation + = K*random (11);//Let the worm rotate between 10 and 10.
A = _rotation*math.pi/180;//converts an angle to radians. (Detailed view above)
DX = Math.Cos (a) *v;
DY = Math.sin (a) *v;
The amount of movement of the horizontal ordinate. (Detailed view above)
_x = + dx;
_y + dy;
Limit the range of insect movements. Focus
Resolution: Determine the scope first. (Wide: 50--750; High: 50--550)
if (_x <= && dx<0 | | _x >= 750 && dx>0) {
_rotation = math.atan2 (DY,-DX) *180/math.pi;
When the}//exceeds the limit, the DX is changed according to the above conditions,
And the rotation angle is changed with the math.atan2 to change the direction of motion.

As shown in Figure 6:

if (_y <= && dy<0 | | _y >=) && dy>0) {
_rotation = math.atan2 (-DY,DX) *180/math.pi;
The principle of}//is ditto.

Six, press Ctrl+enter debugging, see 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.