API Reference › Math › Math.cos
method

Math.cos

Math.cos(radians) -> fixed

Returns the cosine of radians as a fixed in -1.0..1.0, computed as Math.sin(radians + pi/2) off the same deterministic table. Use Math.cos and Math.sin together to convert an angle into an (x, y) direction — for orbits, aiming, or steering.

Example

program Demo {
  handler Step phase Update {
    let x = center_x + Math.cos(angle) * radius
  }
}
← All symbols