Flash realizes the effect of flying birds freely between flowers

Source: Internet
Author: User
Tags insert

A bird in the flower freely fly, suddenly up and down, when fast slow, how carefree. How to achieve this effect? The following author through Flash to achieve the effect of free flying birds.

1. Create a new MC (movie clip) named Bird, and animate a bird in situ to shoot the wing fly animation (pictured).

2. Create a new layer in the scene, import the background (flowers), and make some modifications as needed.

3. Create a new layer named Bird in the scene, add two bird instances to the scene, one named Fly1, and the other one to flip through the transformation, to fly in the opposite direction, named Fly2; to overlap two instances.

Click the first frame of the bird tier timeline and enter the following code:

Qian=xia=xjia=yjia=true;

Defines a few Boolean quantities and sets the initial value to True

I=random (8);

J=random (8);

Defines the initial speed of a bird's flight

fly2._alpha=0;

Hiding the birds from the Zofei

4. Click on the second frame of the timeline, press F6 to insert a keyframe, and enter the code:

if (xjia==true) {

Accelerated x-axis direction

if (i<=12) {i+=1;}
else {xjia=false;}}

else {if (i>=0) {i-=1}

else {xjia=true; I=random (8);}};

if (yjia==true) {

if (j<=12) {j+=1;}

else {yjia=false;}}

else {if (j>=0) {j-=1}

else {yjia=true; Y=rand

OM (8);} };

if (qian==true) {

When the bird flies to the right

fly1._alpha=100;

Head to right bird show


fly2._alpha=0;

if (fly1._x<=400) {

Fly1._x=fly2._x+=i;

if (Xia) {

if (fly1._y<=300) {fly1._y=

Fly2._y+=j;}

else {xia=false;}; };

if (Xia==false) {

if (fly1._y>=20) {fly1._y=

Fly2._y-=j;}

else {xia=true;}; };

}

else {qian=false;};

};

if (Qian==false) {

fly1._alpha=0;

fly2._alpha=100;

if (fly1._x>=30) {

Fly1._x=fly2._x-=i;

if (Xia) {

if (fly1._y<=560) {fly1._y=

Fly2._y+=j; }

else {xia=false;}; };

if (Xia==false) {

if (fly1._y>=20) {fly1._y=

Fly2._y-=j;}

else {xia=true;}; };

}

else {qian=true;};

};

5. Click the timeline third frame press F6 to insert the keyframe, enter the following code: gotoAndPlay (2), and the second frame to form a loop.

So far, the animation is finished.



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.