Name

Math.sin( ) Method — compute the sine of an angle

Availability

Flash 5; may be used when exporting Flash 4 movies

Synopsis

Math.sin(theta)

Arguments

theta

An angle, in radians (not degrees), in the range 0 to 2π.

Returns

The sine of theta (the result is in the range -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.tan( )

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.