Phaser API Documentation

  Version: 

Member of: Phaser.Math.Angle

<static> RotateTo(currentAngle, targetAngle, [lerp])

Description:

Rotates currentAngle towards targetAngle, taking the shortest rotation distance. The lerp argument is the amount to rotate by in this call.

Parameters:

name type arguments Default description
currentAngle number

The current angle, in radians.

targetAngle number

The target angle to rotate to, in radians.

lerp number <optional> 0.05

The lerp value to add to the current angle.

Returns:
Description:

The adjusted angle.

Type:
  • number
Since: 3.0.0
Source: src/math/angle/RotateTo.js (Line 9)