Make a fancy greeting card with flash

Source: Internet
Author: User
Tags abs count eval time interval

Open greeting cards, Christmas Eve of the snow emerged. With the mouse moving, a star gradually flashed, and then flew together, in the night sky to form a shining heart ...

Christmas is coming, don't you want to make a unique greeting card for your GF?

What's up? ok! now let's start making it.

First, the material to be prepared

1. The Flash of the Stars

Includes a round flash and a 10-glyph flash. The circle of Flash is to draw a positive circle first, and then change its fill of white to transparent radial gradient is good, of course, do not forget to delete the Circle Line edge. Make it into a graphical component "glow" after doing well.

The production of a cross is slightly more complicated: first draw a rectangle, and then delete its line edge; change the linear gradient whose fill is white to transparent; Click the Fill Transform tool to adjust the gradient on the rectangle to the appropriate angle (as shown in the figure), and copy the rectangle above three copies, and put it in the shape shown in the figure, And then convert it into a graphical component (note: This step is important, do not convert to components in the next step will occur in the overlapping of the situation, can not achieve the transparent effect of the result; then copy the shape, adjust it perpendicular to the existing figure, and convert the final figure into a graphic component, named "Stargfx "This is the finished product of the ten-zigzag flash."

2. A suitable background: find an atmosphere of the picture as the background of the film. You don't want your film to be just a monotonous number of stars flying, so you can not get the girl to please. The picture should be dark, it is best to have the stars to do the background, so as to match our effect.

The things that need to be prepared are these, and the next thing to do is to combine these simple things into a gorgeous special effect.

Second, the production of film components

1. Stars that will Twinkle

Create a new movie clip, "Star", rename the existing layer "star" and then draw a small circle in the middle of the layer, which is the main body of the star; Create a new layer "starglow" and place the circular glow effect "glow" above the main star body. And then create a new layer of "stargfx" to put our "stargfx" graphic elements above the star body.

And then do the flashing animation effect:

The "STARGFX" layer: Change the alpha value of the first frame "stargfx" element to 0, then add keyframes in frame 5th, change the alpha value of "STARGFX" to 100, rotate it at an appropriate angle (for example, 45 degrees clockwise), and add keyframes to frame tenth to change " STARGFX "has an alpha value of 0 and rotates at the same angle in the same direction as last time, and animation is generated at the end of each keyframe. If you find that the orientation of the component rotates after the animation is different from what you want, you can click any point between the two keyframes, and then change the direction of rotation in the property bar.

The "Glow" layer: The position of the keyframe and the alpha value of the component are adjusted to the same level as the previous one, but the rotation is free.

Extend the frame number of each layer to 70 frames (you can customize it, but preferably not too little.) This is mainly to be in the film when the star flashes there is a time interval, not to flash non-stop.

2. Target point:

Create a new movie clip in which to draw a small square. What does this thing do? Oh, this is where our stars are going to fly, and the specific effects are described in the "Write Action SCRIPT" below.

3. Action Area:

Create a new movie clip "action", rename the existing layer to "background", and drag the background of the picture we imported to the center position. And then a new layer of "star", the next most difficult work begins, we have to use the target point we just made a figure on this layer, that is, we want the final composition of the star pattern, in this case we want to put a heart. Note: After the pendulum is also to each target point to the different instance name, the naming rule is "*+ ordinal number", in this case we use Z1-Z60. This means that our heart is made up of 60 target points, from "Z1" to "z60".

It's finally done. MM's favor is not so easy to ask Oh. Select the pattern you are posing, set its alpha value to 0, so that you do not see them in the film, and no one knows how the stars are so obedient.

Next, drag us to the star "star" to this layer, and change its instance name to "star" as well.

Third, Action script control

OK, now the most critical step is here. First of all, the implementation of the effect of the principle: we first use the target point to create a pattern, and then the film play when the dynamic generation of some stars, to these stars different target points, so that they fly to their respective target point, the final composition of our design. How do you set the target point for each star? We can set a variable in each star's movie clip, assign a value to the variable when the star is generated, and then use the eval ("Z" +num) Form to combine the name of the star's target point in the star Motion ( That's why our target point starts to be named. As for how to let the Stars fly past the program, in fact, have already, remember the wide spread of the mouse root with the script it? Here is only the target point from the mouse coordinates to our own target point.

Do you understand? Then you can try to write it yourself. If you still feel a fog, please see the source code below. The key place already has the detailed annotation.

1. Click the "action" movie clip and write the following code in the Action panel:

Onclipevent (load) {///Initialize some necessary variables when the movie is tuned

Count = 1; Number of the current star

Maxcount = 400; The maximum number of stars allowed to appear in the film

}

Onclipevent (MouseMove) {

if (count

Generate stars and limit the number of stars at a certain probability

Duplicatemovieclip (Star, "star" +count, Count);

if (count<=60) {//The number of stars is still less than the target point

Eval ("star" +count). _xscale = eval ("star" +count). _yscale=100;

Eval ("star" +count). Active = true;

Eval ("star" +count). Mytarget=count; file://Set goals

If {//star exceeds the number of target points, the resulting star will not move, and smaller than the original.

Eval ("star" +count). _xscale = eval ("star" +count). _yscale=50;

Eval ("star" +count). Active = false;

}

Eval ("star" +count). _x = _xmouse; The stars appear in the mouse position

Eval ("star" +count). _y = _ymouse;

count++; Register Plus

}

}

2. Click "Star" in "Action" and write the following code in the Action panel:

Onclipevent (enterframe) {

if (realactive) {

Whether the stars still allow movement, realactive source please see the following (3)

Xm=eval ("_parent.z" +mytarget). _x-_x; file://movement

Ym=eval ("_parent.z" +mytarget). _y-_y;

_X+=XM/10;

_Y+=YM/10;

if (Math.Abs (XM) <0.5 and Math.Abs (YM) <0.5)

Realactive=false; Stop the movement after basically reaching the target point

}

}

3. Edit the "star" movie clip and insert ActionScript as follows:

realactive=active;

The goal is to let the stars stay in place for a while (that is, after the movie is played to 40 frames) and then move to the target point.

Well, that's the rough part of making the process. You can also add more effects to make the film more perfect, such as: Add text animation effect, or increase through the random function to increase the randomness of the action of the Stars and so on, all your own play. Then, on Christmas Eve, to the right mm to send such a greeting card, then, you just steal music!

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.