In Flash, positive angles are measured from the x-axis and are rotated in a clockwise
direction as shown in Figure 1. Angles of rotation are measured in degrees (0 to
360). Negative angles (0 to –360) are measured in a counterclockwise direction from
the x-axis. The rotation of an object is about its registration point.
Figure:1 Measuring angles in Flash
Unfortunately for many of us and especially those working with ActionScript, there is another unit of angle measurement called radians. A long time ago, some Greek wasthinking about circles and said to himself, “Suppose I have an arc of a circle that isequal in length to the radius of the circle. I’ll call the angle that the arc makes a radian.I wonder how many of those make up half a circle. Wouldn’t it be nice if the number were a whole number?
Figure2: One radian of a circle
It certainly would have been nice if three or four made up a semicircle but alas, it was
not to be. It turned out that a little more than three radians make up a semicircle. The
Greeks found that the number is about 3.14159 and is often written as the Greek let-
ter p. Flash refers to this number as Math.PI so that you don’t have to remember it in
order to use it.
“That’s interesting,” you may be thinking, “but why should I care about any of this?”
The reason is that while most of us feel comfortable measuring angles in degrees, the
folks who write software such as Flash prefer to measure angles in radians. So, like it
or not, we often need to bounce back and forth between degrees and radians.
The following equations provides the necessary formulas that you will need for converting from one to the other. Note that there are 360 degrees or 2p radians in a circle. Try to learn them
if you can or write them down on your hand or just refer to these equations when you
need them.
It certainly would have been nice if three or four made up a semicircle but alas, it was
not to be. It turned out that a little more than three radians make up a semicircle. The
Greeks found that the number is about 3.14159 and is often written as the Greek let-
ter p. Flash refers to this number as Math.PI so that you don’t have to remember it in
order to use it.
“That’s interesting,” you may be thinking, “but why should I care about any of this?”
The reason is that while most of us feel comfortable measuring angles in degrees, the
folks who write software such as Flash prefer to measure angles in radians. So, like it
or not, we often need to bounce back and forth between degrees and radians.
The following equations provides the necessary formulas that you will need for converting from one to the other. Note that there are 360 degrees or 2p radians in a circle. Try to learn them
if you can or write them down on your hand or just refer to these equations when you
need them.
Degrees to radians: angleInRadians = angleInDegrees * ( Math.PI/180 )
Radians to degrees: angleInDegrees = angleInRadians * ( 180/Math.PI )
In the next tutorial we'll move an object in a rectanguler path.That's easy.
In the next tutorial we'll move an object in a rectanguler path.That's easy.
No comments:
Post a Comment