Math.sin( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Math.sin( ) Method Flash 5; can be used when exporting Flash 4 movies

compute the sine of an angle
Math.sin(theta)

Arguments

theta

An angle, in radians (not degrees), normally in the range of 0 to 2figs/u03c0.gif, although any angle will suffice, as sine is a periodic function.

Returns

The sine of theta (the result is in the range of -1.0 to 1.0).

Description

The sin( ) method returns the trigonometric sine of an angle. In a right triangle, the sine of an angle is the result of dividing the length of the side opposite the angle by the triangle's hypotenuse.

Usage

Note that sin( ) expects angles to be provided in radians, not degrees.

Example

trace(Math.sin(0));            // Displays: 0 trace(Math.sin(Math.PI/2));    // Displays: 1.0

The sin( ) function can be used along with cos( ) to calculate a point on a circle. See the Example under Math.cos( ).

See Also

Math.asin( ), Math.cos( ), Math.PI, Math.tan( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net