phaser - v4.0.0-rc.4
    Preparing search index...

    Function ShortestBetween

    • Gets the shortest angle between angle1 and angle2.

      Both angles must be in the range -180 to 180, which is the same clamped range that sprite.angle uses, so you can pass in two sprite angles to this method and get the shortest angle back between the two of them.

      The angle returned will be in the same range. If the returned angle is greater than 0 then it's a counter-clockwise rotation, if < 0 then it's a clockwise rotation.

      For calculation in radians use Phaser.Math.Angle.GetShortestDistance instead.

      Parameters

      • angle1: number

        The first angle in the range -180 to 180.

      • angle2: number

        The second angle in the range -180 to 180.

      Returns number