Phaser API Documentation

  Version: 
<static> GetPoint(rectangle, position, [out])

Description:

Calculates the coordinates of a point at a certain position on the Rectangle's perimeter.

The position is a fraction between 0 and 1 which defines how far into the perimeter the point is.

A value of 0 or 1 returns the point at the top left corner of the rectangle, while a value of 0.5 returns the point at the bottom right corner of the rectangle. Values between 0 and 0.5 are on the top or the right side and values between 0.5 and 1 are on the bottom or the left side.

Parameters:

name type arguments description
rectangle Phaser.Geom.Rectangle

The Rectangle to get the perimeter point from.

position number

The normalized distance into the Rectangle's perimeter to return.

out object | Phaser.Geom.Point <optional>

An object to update with the x and y coordinates of the point.

Returns:
Description:

The updated output object, or a new Point if no output object was given.

Since: 3.0.0