CLASSES
TagsA - Z

Path2

Description

class Path2

Constructor

new Path2(x, y)

Creates a Path2 object from the starting 2D coordinates x and y.

Parameters

Name Type Description
x number
y number

Members

closed : boolean

Methods

addLineTo(x, y) → Path2

Adds a new segment until the passed coordinates (x, y) to the current Path2.

Returns the updated Path2.

Parameters

Name Type Description
x number
y number

addArcTo(midX, midY, endX, endY, numberOfSegments) → Path2

Adds numberOfSegments segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.

Returns the updated Path2.

Parameters

Name Type Description
midX number
midY number
endX number
endY number

close() → Path2

Closes the Path2.

Returns the Path2.

length() → number

Returns the Path2 total length (float).

getPoints() → Vector2[]

Returns the Path2 internal array of points.

getPointAtLengthPosition(normalizedLengthPosition) → Vector2

Returns a new Vector2 located at a percentage of the Path2 total length on this path.

Parameters

Name Type Description
normalizedLengthPosition number

static StartingAt(x, y) → Path2

Returns a new Path2 starting at the coordinates (x, y).

Parameters

Name Type Description
x number
y number