API Reference › Math › Math.tan
method

Math.tan

Math.tan(radians) -> fixed

Returns the tangent of radians, computed as Math.sin(radians) / Math.cos(radians) in fixed-point. Near odd multiples of pi/2 the cosine approaches zero and the result grows without bound, so guard those angles. For most gameplay, Math.sin/Math.cos are what you want; tan is here for slopes and field-of-view math.

Example

program Demo {
  handler Step phase Update {
    let slope = Math.tan(pitch)
  }
}
← All symbols