JavaScript Math.sin() Method
The Math.sin() static method returns the sine of an angle given in radians.
Description
The Math.sin() static method returns the sine of an angle in radians. It's used for circular motion, waves and smooth oscillating animations. Because of floating point precision, Math.sin(Math.PI) is a tiny number rather than exactly 0.
To position a point on a circle, combine it with Math.cos(): x = cx + r * Math.cos(angle) and y = cy + r * Math.sin(angle). Using a growing value such as elapsed time as the angle gives a smooth wave, which is useful for bobbing or pulsing animations.
Remember that the argument must be in radians, so convert degrees with deg * Math.PI / 180. The inverse function, Math.asin(), returns the angle for a given sine. Like every member of Math, it's called on the Math object itself rather than on a number, and it only works with the Number type: passing a BigInt throws a TypeError.
Syntax
Math.sin(x)Parameters
- xAn angle in radians.
Return Value
The sine of the angle, from -1 to 1.
Example
Browser Support
The following information will show you the current browser support for the Math.sin() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





