Class: Path

Phaser.Curves. Path

[description]


new Path( [x] [, y])

Parameters:
Name Type Argument Default Description
x number <optional>
0

[description]

y number <optional>
0

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 30)

Members


autoClose :boolean

Automatically closes the path.

Type:
  • boolean
Since: 3.0.0
Default Value:
  • false
Source: src/curves/path/Path.js (Line 81)

cacheLengths :Array.<number>

[description]

Type:
  • Array.<number>
Since: 3.0.0
Default Value:
  • []
Source: src/curves/path/Path.js (Line 71)

curves :Array.<Phaser.Curves.Curve>

[description]

Type:
Since: 3.0.0
Default Value:
  • []
Source: src/curves/path/Path.js (Line 61)

name :string

[description]

Type:
  • string
Since: 3.0.0
Default Value:
  • ''
Source: src/curves/path/Path.js (Line 51)

startPoint :Phaser.Math.Vector2

[description]

Type:
Since: 3.0.0
Source: src/curves/path/Path.js (Line 91)

Methods


add(curve)

[description]

Parameters:
Name Type Description
curve Phaser.Curves.Curve

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 130)
Returns:

[description]

Type
Phaser.Curves.Path

circleTo(radius [, clockwise] [, rotation])

[description]

Parameters:
Name Type Argument Default Description
radius number

[description]

clockwise boolean <optional>
false

[description]

rotation number <optional>
0

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 147)
Returns:

[description]

Type
Phaser.Curves.Path

closePath()

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 166)
Returns:

[description]

Type
Phaser.Curves.Path

cubicBezierTo(x, y, control1X [, control1Y] [, control2X] [, control2Y])

Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points.

Parameters:
Name Type Argument Description
x number | Phaser.Math.Vector2

The x coordinate of the end point. Or, if a Vec2, the p1 value.

y number | Phaser.Math.Vector2

The y coordinate of the end point. Or, if a Vec2, the p2 value.

control1X number | Phaser.Math.Vector2

The x coordinate of the first control point. Or, if a Vec2, the p3 value.

control1Y number <optional>

The y coordinate of the first control point. Not used if vec2s are provided as the first 3 arguments.

control2X number <optional>

The x coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments.

control2Y number <optional>

The y coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments.

Since: 3.0.0
Source: src/curves/path/Path.js (Line 189)
Returns:

[description]

Type
Phaser.Curves.Path

destroy()

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 781)

draw(graphics [, pointsTotal])

[description]

Parameters:
Name Type Argument Default Description
graphics Phaser.GameObjects.Graphics

[description]

pointsTotal integer <optional>
32

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 264)
Returns:

[description]

Type
Phaser.GameObjects.Graphics

ellipseTo(xRadius, yRadius, startAngle, endAngle, clockwise, rotation)

Creates an ellipse curve positioned at the previous end point, using the given parameters.

Parameters:
Name Type Description
xRadius number

[description]

yRadius number

[description]

startAngle number

[description]

endAngle number

[description]

clockwise boolean

[description]

rotation number

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 294)
Returns:

[description]

Type
Phaser.Curves.Path

fromJSON(data)

[description]

Parameters:
Name Type Description
data object

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 326)
Returns:

[description]

Type
Phaser.Curves.Path

getBounds( [out] [, accuracy])

[description]

Parameters:
Name Type Argument Default Description
out Phaser.Geom.Rectangle <optional>

[description]

accuracy integer <optional>
16

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 378)
Returns:

[description]

Type
Phaser.Geom.Rectangle

getCurveLengths()

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 427)
Returns:

[description]

Type
Array.<number>

getEndPoint( [out])

[description]

Parameters:
Name Type Argument Description
out Phaser.Math.Vector2 <optional>

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 462)
Returns:

[description]

Type
Phaser.Math.Vector2

getLength()

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 490)
Returns:

[description]

Type
number

getPoint(t [, out])

[description]

Parameters:
Name Type Argument Description
t number

[description]

out Phaser.Math.Vector2 <optional>

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 514)
Returns:

[description]

Type
Phaser.Math.Vector2

getPoints( [divisions])

[description]

Parameters:
Name Type Argument Default Description
divisions integer <optional>
12

The number of points to divide the path in to.

Since: 3.0.0
Source: src/curves/path/Path.js (Line 555)
Returns:

An array of Vector2 objects that containing the points along the Path.

Type
Array.<Phaser.Math.Vector2>

getRandomPoint( [out])

[description]

Parameters:
Name Type Argument Description
out Phaser.Math.Vector2 <optional>

Vector2 instance that should be used for storing the result. If undefined a new Vector2 will be created.

Since: 3.0.0
Source: src/curves/path/Path.js (Line 609)
Returns:

[description]

Type
Phaser.Math.Vector2

getSpacedPoints( [divisions])

[description]

Parameters:
Name Type Argument Default Description
divisions integer <optional>
40

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 628)
Returns:

[description]

Type
Array.<Phaser.Math.Vector2>

getStartPoint( [out])

[description]

Parameters:
Name Type Argument Description
out Phaser.Math.Vector2 <optional>

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 657)
Returns:

[description]

Type
Phaser.Math.Vector2

lineTo(x [, y])

[description]

Parameters:
Name Type Argument Description
x number | Phaser.Math.Vector2

[description]

y number <optional>

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 678)
Returns:

[description]

Type
Phaser.Curves.Path

moveTo(x, y)

[description]

Parameters:
Name Type Description
x number

[description]

y number

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 724)
Returns:

[description]

Type
Phaser.Curves.Path

quadraticBezierTo(x [, y] [, controlX] [, controlY])

[description]

Parameters:
Name Type Argument Description
x number | Array.<Phaser.Math.Vector2>

[description]

y number <optional>

[description]

controlX number <optional>

[description]

controlY number <optional>

[description]

Since: 3.2.0
Source: src/curves/path/Path.js (Line 230)
Returns:

[description]

Type
Phaser.Curves.Path

splineTo(points)

[description]

Parameters:
Name Type Description
points Array.<Phaser.Math.Vector2>

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 707)
Returns:

[description]

Type
Phaser.Curves.Path

toJSON()

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 740)
Returns:

[description]

Type
JSONPath

updateArcLengths()

[description]

Since: 3.0.0
Source: src/curves/path/Path.js (Line 768)