The eighth chapter of Flash theory course Ⅰ of slow motion and elastic movement

Source: Internet
Author: User

Back to "flash Basic Theory Class-Catalog"

It is hard to believe that we actually used seven chapters to introduce the basics, now into the eighth chapter, here is the starting point of high-level content. Starting from here, the content is becoming more and more interesting, and the previous chapters are common concepts and techniques. Starting today, each chapter focuses on only one or two special sports.

This chapter will introduce the slow motion (proportional velocity) and the elastic motion (proportional acceleration) without fear that they are just two noun terms, which can be quickly skimmed. I'll give you a lot of examples of how powerful this technology can be.

Proportional movement

Easing (ease) is strongly associated with elasticity (spring). Both of these methods move an object (usually Sprite or MovieClip) from one point to the target point. Use the Ease movement (easing) as if you want the movie to slide to the target and stop. The use of elastic motions (springing) produces a forward or backward bounce, which eventually stops at the target point. The two methods have some common points:

Need a target point;

Determine the distance to the target point;

Move the movie proportionally to the target point-the farther away, the faster the move.

The difference between the slow motion (easing) and the elastic Motion (springing) is the proportion of the movement. In the slow motion, the speed is proportional to the distance, the farther away from the target, the faster the object moves. When objects are very, very close to the target point, they are almost motionless.

When the elastic motion, the acceleration is proportional to the distance. If the object is far away from the target, then the acceleration will make the movement very fast. When the object is close to the target, the acceleration decreases, but it still exists! The object will fly over the target point and then pull it back by the reverse acceleration. Eventually, the friction is used to keep it still.

Now, let's take a look at both of these methods, starting with the easing (easing).

Easing (easing)

First of all, there is not only one kind of easing. In the Flash IDE, when making motion tweens, we can see "ease input" (ease in) and "easing output" (ease out). The easing type discussed below is similar to the "easing output" of motion tweens. The "Advanced easing" section later in this chapter will give you a site connection where you can learn to make all the easing effects.

Simple Slow motion

Simple easing is a very basic concept of moving an object elsewhere. When you create this "motion effect," you want the object to move slowly to a point within a few frames. We can find the angle between two points, then set the speed, then use trigonometry to calculate the VX and VY, and then let the object move. Each frame determines the distance between the object and the target point, and stops if the target is reached. This kind of movement also requires certain conditions of constraint to achieve, but if you want to move the object naturally, this method is obviously not feasible.

The problem is that the object moves along a fixed speed and direction and stops immediately after reaching the target point. This method, used to show objects hitting the wall of the scene, perhaps more appropriate. But the process by which an object moves to a target point is like a person who clearly knows his destination and then plans to move forward toward the goal, at first the speed of movement is very fast, and the speed begins to slow down when approaching the target point. In other words, its velocity vector is proportional to the distance of the target point.

Let me give you an example first. For example, when we drive home, when we are thousands of meters away from home, we have to go at full speed, and when we get out of the street, we'll be a little slower. It's going to be a little bit slower when you're two blocks down. When entering the garage, the speed may be only a few miles. When entering the parking space, the speed is even slower, at a few feet, the speed is almost zero.

If you look at it, you'll find that this behavior is like closing a door and pushing a drawer. Start at a very fast pace and slow down gradually.

Motion appears natural when we use the ease to return the object. Simple ease of movement is also very simple to achieve, than to find the angle, calculate the Vx,vy is also simple. The following are implementation strategies for easing:

1. To determine a number as a motion proportional coefficient, which is less than 1 of the score;

2. Setting the target point;

3. Calculate the distance between the object and the target point;

4. The velocity vector is obtained by multiplying the distance by the proportional coefficient;

5. Add the velocity vector to the coordinates of the current object;

6. Repeat 3 to 5 steps. Figure 8-1 explains this process.

Figure 8-1 Simple ease of movement

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.