July 12, 2000 - Animation with Math.cos()
July 12, 2000|
Animation with Math.cos()
Tips: July 2000
Yehuda Shiran, Ph.D.
Math.cos()method accepts one argument (an angle in radians) and returns its cosine value. The following statement prints "-1":
Math.cos() method is useful in animation applications. If an object A revolves around object B in a constant-radius orbit, its y location can be derived by multiplying the orbiting radius by the cosine of the angle that the radius makes with the upright ray.
Math.acos()method accepts one argument and returns the arc cosine (the angle that the given number is its cosine value) of the argument, in radians. The following statement prints the value of PI: