Phaser API Documentation


Member of: Phaser.Geom.Line

<static> Extend(line, left, [right])


Extends the start and end points of a Line by the given amounts.

The amounts can be positive or negative. Positive points will increase the length of the line, while negative ones will decrease it.

If no right value is provided it will extend the length of the line equally in both directions.

Pass a value of zero to leave the start or end point unchanged.


name type arguments description
line Phaser.Geom.Line

The line instance to extend.

left number

The amount to extend the start of the line by.

right number <optional>

The amount to extend the end of the line by. If not given it will be set to the left value.


The modified Line instance.

Since: 3.16.0
Source: src/geom/line/Extend.js (Line 9)