Curves and Paths
Creating paths from curves, getting points along them, drawing them with Graphics, and making sprites follow paths automatically using PathFollower in Phaser 4.
Key source paths: src/curves/, src/curves/path/, src/gameobjects/pathfollower/, src/gameobjects/components/PathFollower.js
Related skills: ../sprites-and-images/SKILL.md, ../graphics-and-shapes/SKILL.md, ../tweens/SKILL.md
Quick Start
// In a Scene's create() method:
// 1. Create a Path starting at (50, 300)
const path = this.add.path(50, 300);
// 2. Add curves to the path
path.lineTo(200, 100);
path.splineTo([ new Phaser.Math.Vector2(300, 400), new Phaser.Math.Vector2(500, 200) ]);
path.lineTo(700, 300);
// 3. Draw the path using Graphics
const graphics = this.add.graphics();
graphics.lineStyle(2, 0xffffff, 1);
path.draw(graphics, 64);
// 4. Create a PathFollower sprite that moves along the path
const follower = this.add.follower(path, 50, 300, 'ship');
follower.startFollow({
duration: 5000,
rotateToPath: true,
repeat: -1,
yoyo: true
});
Core Concepts
Path
A Phaser.Curves.Path is a container that combines multiple Curves into one continuous compound curve. Curves in a Path do not need to be connected end-to-end. Only the order of curves affects point calculations along the path.
Created via factory: this.add.path(x, y) where x/y is the starting point.
Key properties:
curves -- array of Phaser.Curves.Curve objects in the Path
startPoint -- Vector2, the defined starting position
autoClose -- boolean, if true getPoints() appends the first point at the end
defaultDivisions -- number (default: 12), divisions per curve when calling getPoints()
name -- string, empty by default, for developer use
Curves
All curve types extend Phaser.Curves.Curve (the base class). Every curve supports:
getPoint(t, out) -- get a point at position t (0-1) based on curve parameterization
getPointAt(u, out) -- get a point at position u (0-1) based on arc length (evenly spaced)
getPoints(divisions, stepRate, out) -- array of points along the curve
getSpacedPoints(divisions, stepRate, out) -- array of equidistant points by arc length
getDistancePoints(distance) -- points spaced by pixel distance
getLength() -- total arc length in pixels
getBounds(out, accuracy) -- bounding Rectangle
getTangent(t, out) / getTangentAt(u, out) -- unit tangent vector
getStartPoint(out) / getEndPoint(out) -- first/last points
getRandomPoint(out) -- random point on the curve
draw(graphics, pointsTotal) -- render the curve onto a Graphics object
active -- boolean, when false the parent Path skips this curve
PathFollower
A Phaser.GameObjects.PathFollower is a Sprite with the Components.PathFollower mixin. It uses an internal Tween (a number counter from 0 to 1) to advance along a Path each frame.
Created via factory: this.add.follower(path, x, y, texture, frame)
The PathFollower component provides:
path -- the Phaser.Curves.Path being followed
pathTween -- the internal Tween driving movement
pathOffset -- Vector2, offset added to path coordinates
pathVector -- Vector2, current position on the path
pathDelta -- Vector2, distance traveled since last frame
rotateToPath -- boolean, auto-rotate to face path direction
pathRotationOffset -- number (degrees), added to auto-rotation
Common Patterns
Creating Paths with Chained Curves
Path has convenience methods that create curves starting from the previous end point:
const path = this.add.path(100, 500);
path.lineTo(300, 100); // straight line
path.cubicBezierTo(500, 100, 350, 50, 450, 50); // cubic bezier (endX, endY, cp1X, cp1Y, cp2X, cp2Y)
path.quadraticBezierTo(700, 400, 600, 100); // quadratic bezier (endX, endY, cpX, cpY)
path.splineTo([ // spline through points
new Phaser.Math.Vector2(750, 300),
new Phaser.Math.Vector2(600, 500)
]);
path.ellipseTo(50, 80, 0, 270, false, 0); // ellipse arc (xRadius, yRadius, startAngle, endAngle, clockwise, rotation)
path.circleTo(40); // shortcut for ellipseTo with equal radii and 0-360
// Jump to a new position without drawing (creates a gap)
path.moveTo(400, 400);
path.lineTo(500, 400);
// Close the path by connecting end to start
path.closePath();
Adding Standalone Curve Objects
const path = new Phaser.Curves.Path(0, 0);
// Add pre-constructed curve objects
const line = new Phaser.Curves.Line(new Phaser.Math.Vector2(0, 0), new Phaser.Math.Vector2(200, 200));
path.add(line);
const spline = new Phaser.Curves.Spline([ 200, 200, 300, 100, 400, 300 ]);
path.add(spline);
const ellipse = new Phaser.Curves.Ellipse(400, 300, 100, 60, 0, 360, false, 0);
path.add(ellipse);
Getting Points Along a Path
// Array of points (uses defaultDivisions per curve)
const points = path.getPoints();
// With explicit divisions per curve
const detailed = path.getPoints(32);
// Equally spaced points along the entire path
const spaced = path.getSpacedPoints(100);
// Single point at normalized position (0-1)
const midpoint = path.getPoint(0.5);
// Tangent vector at a position
const tangent = path.getTangent(0.5);
// Total path length in pixels
const length = path.getLength();
// Bounding rectangle
const bounds = path.getBounds();
Drawing Paths with Graphics
const graphics = this.add.graphics();
// Draw entire path
graphics.lineStyle(2, 0x00ff00, 1);
path.draw(graphics, 64); // 64 = points per curve for smoothness
// Draw individual curves
graphics.lineStyle(1, 0xff0000, 1);
path.curves[0].draw(graphics, 32);
// Draw debug points
const points = path.getSpacedPoints(50);
points.forEach(p => {
graphics.fillStyle(0xffff00, 1);
graphics.fillCircle(p.x, p.y, 3);
});
PathFollower Sprite
const path = this.add.path(100, 200);
path.lineTo(400, 400);
path.lineTo(700, 200);
// Create follower
const enemy = this.add.follower(path, 100, 200, 'enemy');
// Start following with config
enemy.startFollow({
duration: 3000, // ms to traverse path
positionOnPath: true, // snap to path start position
rotateToPath: true, // auto-rotate to face direction
rotationOffset: 90, // offset added to auto-rotation (degrees)
repeat: -1, // -1 = infinite repeat
yoyo: true, // reverse on each repeat
from: 0, // start position on path (0-1)
to: 1, // end position on path (0-1)
startAt: 0, // initial seek position
ease: 'Sine.easeInOut' // any valid Phaser ease
});
// Control during playback
enemy.pauseFollow();
enemy.resumeFollow();
enemy.stopFollow();
enemy.isFollowing(); // returns boolean
// Change path at runtime
enemy.setPath(newPath);
enemy.setPath(newPath, { duration: 2000 }); // auto-starts
// Set rotation independently
enemy.setRotateToPath(true, 90); // (value, offsetDegrees)
PathFollower with Simple Duration
// Shorthand: pass just a duration number
enemy.startFollow(5000);
// Equivalent to:
enemy.startFollow({ duration: 5000 });
All Curve Types
| Curve |
Class |
Constructor Params |
Description |
| Line |
Phaser.Curves.Line |
(p0, p1) Vector2 endpoints, or ([x0,y0,x1,y1]) |
Straight line segment between two points |
| Spline |
Phaser.Curves.Spline |
(points) array of Vector2, flat numbers, or nested arrays |
Catmull-Rom spline through control points |
| CubicBezier |
Phaser.Curves.CubicBezier |
(p0, p1, p2, p3) or ([x0,y0,...x3,y3]) |
Cubic Bezier with start, 2 control points, end |
| QuadraticBezier |
Phaser.Curves.QuadraticBezier |
(p0, p1, p2) or ([x0,y0,...x2,y2]) |
Quadratic Bezier with start, 1 control point, end |
| Ellipse |
Phaser.Curves.Ellipse |
(x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation) or config object |
Elliptical arc; angles in degrees; yRadius defaults to xRadius |
Ellipse Curve Properties
The Ellipse curve has get/set properties for runtime modification:
x, y -- center position
xRadius, yRadius -- radii
startAngle, endAngle -- in degrees (get/set convert to/from radians internally)
clockwise -- boolean
rotation -- in radians
angle -- rotation in degrees (alternative to rotation)
setWidth(value) / setHeight(value) -- sets radius to value/2
API Quick Reference
Path (Phaser.Curves.Path)
| API |
Type |
Description |
add(curve) |
method |
Append any Curve to the path |
lineTo(x, y) |
method |
Add a Line from current end point |
splineTo(points) |
method |
Add a Spline from current end point |
cubicBezierTo(x, y, cp1X, cp1Y, cp2X, cp2Y) |
method |
Add CubicBezier from current end point |
quadraticBezierTo(x, y, cpX, cpY) |
method |
Add QuadraticBezier from current end point |
ellipseTo(xR, yR, start, end, cw, rot) |
method |
Add Ellipse arc from current end point |
circleTo(radius, clockwise, rotation) |
method |
Shortcut for ellipseTo with equal radii |
moveTo(x, y) |
method |
Move end point without drawing (creates gap) |
closePath() |
method |
Add Line from end to start if not already closed |
getPoint(t, out) |
method |
Point at normalized position (0-1) on entire path |
getPoints(divisions, stepRate) |
method |
Array of points, divisions per curve |
getSpacedPoints(divisions) |
method |
Equidistant points along entire path |
getRandomPoint(out) |
method |
Random point anywhere on the path |
getStartPoint(out) |
method |
Path starting point |
getEndPoint(out) |
method |
Path ending point |
getTangent(t, out) |
method |
Unit tangent vector at position t |
getCurveAt(t) |
method |
Return the Curve at normalized position t |
getLength() |
method |
Total path length in pixels |
getCurveLengths() |
method |
Array of cumulative curve lengths |
getBounds(out, accuracy) |
method |
Bounding Rectangle |
draw(graphics, pointsTotal) |
method |
Draw all curves onto a Graphics object |
toJSON() / fromJSON(data) |
method |
Serialization |
updateArcLengths() |
method |
Force recalculation of cached lengths |
destroy() |
method |
Clear internal references |
Base Curve (Phaser.Curves.Curve)
| API |
Type |
Description |
getPoint(t, out) |
method |
Point at parameter t (0-1) -- abstract, each subclass implements |
getPointAt(u, out) |
method |
Point at arc-length position u (0-1) -- evenly spaced |
getPoints(divisions, stepRate, out) |
method |
Array of points |
getSpacedPoints(divisions, stepRate, out) |
method |
Equidistant points by arc length |
getDistancePoints(distance) |
method |
Points spaced by pixel distance |
getLength() |
method |
Total curve arc length |
getTangent(t, out) / getTangentAt(u, out) |
method |
Unit tangent vector |
getTFromDistance(distance) |
method |
Convert pixel distance to t value |
draw(graphics, pointsTotal) |
method |
Render onto Graphics (default 32 points) |
getBounds(out, accuracy) |
method |
Bounding Rectangle |
active |
boolean |
When false, parent Path skips this curve |
defaultDivisions |
number |
Default 5 for standalone curves |
arcLengthDivisions |
number |
Precision for arc length calculations (default 100) |
PathFollower Component
| API |
Type |
Description |
setPath(path, config) |
method |
Set a new Path (optionally auto-start) |
startFollow(config, startAt) |
method |
Begin following; config = duration number or PathConfig |
pauseFollow() |
method |
Pause movement |
resumeFollow() |
method |
Resume paused movement |
stopFollow() |
method |
Stop following |
isFollowing() |
method |
Returns true if actively moving on path |
setRotateToPath(value, offset) |
method |
Enable/disable auto-rotation with offset |
path |
Path |
Current path reference |
pathTween |
Tween |
Internal tween driving movement |
pathOffset |
Vector2 |
Offset from path coordinates |
pathVector |
Vector2 |
Current position on the path |
pathDelta |
Vector2 |
Movement delta since last update |
rotateToPath |
boolean |
Auto-rotate to path direction |
pathRotationOffset |
number |
Rotation offset in degrees |
PathConfig (Phaser.Types.GameObjects.PathFollower.PathConfig)
| Property |
Type |
Default |
Description |
duration |
number |
1000 |
Time in ms to traverse the path |
from |
number |
0 |
Start position on path (0-1) |
to |
number |
1 |
End position on path (0-1) |
positionOnPath |
boolean |
false |
Snap follower to path start on begin |
rotateToPath |
boolean |
false |
Auto-rotate to face path direction |
rotationOffset |
number |
0 |
Degrees added to auto-rotation |
startAt |
number |
0 |
Initial seek position on path (0-1) |
The config also accepts all standard Tween properties: ease, repeat, yoyo, delay, hold, onComplete, etc.
Gotchas
getPoint(t) vs getPointAt(u) on curves. getPoint uses the raw curve parameter t, which does not produce evenly spaced points on most curve types. getPointAt maps through arc length for even spacing. On a Path, getPoint already accounts for arc length across the whole path.
Path moveTo creates an inactive curve. The MoveTo pseudo-curve has active: false and zero length. It only repositions the end point for the next curve. It does not draw anything and is skipped by getPoints() and draw().
PathFollower uses a Tween internally. The startFollow config is passed to scene.tweens.addCounter(). All tween properties (ease, delay, repeat, yoyo, callbacks) work. The tween is set to persist: true automatically.
PathFollower offset behavior. When positionOnPath: false (default), the follower's current position becomes the offset from the path start. When positionOnPath: true, the follower snaps to the path's start point and the offset is zeroed.
Ellipse angles are in degrees. The constructor and startAngle/endAngle properties accept degrees. Internally they are stored as radians. The rotation property is in radians, but angle is in degrees.
closePath vs autoClose. closePath() adds an explicit Line curve from end to start. autoClose = true only affects getPoints() and getSpacedPoints() output by appending the first point, without adding a curve.
Cached lengths can go stale. getCurveLengths() caches results based on array length only. If you modify a curve's control points, call path.updateArcLengths() to force recalculation.
cubicBezierTo parameter order with numbers. When passing numbers: cubicBezierTo(endX, endY, cp1X, cp1Y, cp2X, cp2Y). The end point comes first, not the control points. When passing Vector2 objects: cubicBezierTo(cp1, cp2, endPoint).
Spline needs at least 4 points. The Catmull-Rom interpolation used by Spline works best with 4+ points. With fewer points, the curve may not behave as expected.
Line curve arcLengthDivisions is 1. Unlike other curves (default 100), Line overrides this to 1 since a line is inherently uniform. No need to adjust it.
Source File Map
| File |
Purpose |
src/curves/path/Path.js |
Path class -- combines multiple curves, factory registered as this.add.path |
src/curves/path/MoveTo.js |
MoveTo pseudo-curve for creating gaps in paths |
src/curves/Curve.js |
Base Curve class -- shared methods for all curve types |
src/curves/LineCurve.js |
Line curve (two-point segment) |
src/curves/SplineCurve.js |
Spline curve (Catmull-Rom through multiple points) |
src/curves/CubicBezierCurve.js |
Cubic Bezier curve (4 control points) |
src/curves/QuadraticBezierCurve.js |
Quadratic Bezier curve (3 control points) |
src/curves/EllipseCurve.js |
Ellipse/arc curve with angle and rotation support |
src/gameobjects/pathfollower/PathFollower.js |
PathFollower Game Object (extends Sprite + PathFollower mixin) |
src/gameobjects/pathfollower/PathFollowerFactory.js |
this.add.follower factory registration |
src/gameobjects/components/PathFollower.js |
PathFollower component mixin (setPath, startFollow, pathUpdate, etc.) |
src/gameobjects/pathfollower/typedefs/PathConfig.js |
PathConfig typedef |
1---2name: curves-and-paths3description: "Use this skill when working with curves and paths in Phaser 4. Covers splines, bezier curves, lines, ellipses, path followers, and mathematical curve types. Triggers on: curve, path, spline, bezier, path follower."4metadata:5 source: https://skillmd.com/skills/phaserjs/curves-and-paths6---78# Curves and Paths9> Creating paths from curves, getting points along them, drawing them with Graphics, and making sprites follow paths automatically using PathFollower in Phaser 4.1011**Key source paths:** `src/curves/`, `src/curves/path/`, `src/gameobjects/pathfollower/`, `src/gameobjects/components/PathFollower.js`12**Related skills:** ../sprites-and-images/SKILL.md, ../graphics-and-shapes/SKILL.md, ../tweens/SKILL.md1314## Quick Start1516```js17// In a Scene's create() method:1819// 1. Create a Path starting at (50, 300)20const path = this.add.path(50, 300);2122// 2. Add curves to the path23path.lineTo(200, 100);24path.splineTo([ new Phaser.Math.Vector2(300, 400), new Phaser.Math.Vector2(500, 200) ]);25path.lineTo(700, 300);2627// 3. Draw the path using Graphics28const graphics = this.add.graphics();29graphics.lineStyle(2, 0xffffff, 1);30path.draw(graphics, 64);3132// 4. Create a PathFollower sprite that moves along the path33const follower = this.add.follower(path, 50, 300, 'ship');34follower.startFollow({35 duration: 5000,36 rotateToPath: true,37 repeat: -1,38 yoyo: true39});40```4142## Core Concepts4344### Path4546A `Phaser.Curves.Path` is a container that combines multiple Curves into one continuous compound curve. Curves in a Path do not need to be connected end-to-end. Only the order of curves affects point calculations along the path.4748Created via factory: `this.add.path(x, y)` where x/y is the starting point.4950Key properties:51- `curves` -- array of `Phaser.Curves.Curve` objects in the Path52- `startPoint` -- `Vector2`, the defined starting position53- `autoClose` -- boolean, if true `getPoints()` appends the first point at the end54- `defaultDivisions` -- number (default: 12), divisions per curve when calling `getPoints()`55- `name` -- string, empty by default, for developer use5657### Curves5859All curve types extend `Phaser.Curves.Curve` (the base class). Every curve supports:60- `getPoint(t, out)` -- get a point at position t (0-1) based on curve parameterization61- `getPointAt(u, out)` -- get a point at position u (0-1) based on arc length (evenly spaced)62- `getPoints(divisions, stepRate, out)` -- array of points along the curve63- `getSpacedPoints(divisions, stepRate, out)` -- array of equidistant points by arc length64- `getDistancePoints(distance)` -- points spaced by pixel distance65- `getLength()` -- total arc length in pixels66- `getBounds(out, accuracy)` -- bounding Rectangle67- `getTangent(t, out)` / `getTangentAt(u, out)` -- unit tangent vector68- `getStartPoint(out)` / `getEndPoint(out)` -- first/last points69- `getRandomPoint(out)` -- random point on the curve70- `draw(graphics, pointsTotal)` -- render the curve onto a Graphics object71- `active` -- boolean, when false the parent Path skips this curve7273### PathFollower7475A `Phaser.GameObjects.PathFollower` is a Sprite with the `Components.PathFollower` mixin. It uses an internal Tween (a number counter from 0 to 1) to advance along a Path each frame.7677Created via factory: `this.add.follower(path, x, y, texture, frame)`7879The PathFollower component provides:80- `path` -- the `Phaser.Curves.Path` being followed81- `pathTween` -- the internal Tween driving movement82- `pathOffset` -- `Vector2`, offset added to path coordinates83- `pathVector` -- `Vector2`, current position on the path84- `pathDelta` -- `Vector2`, distance traveled since last frame85- `rotateToPath` -- boolean, auto-rotate to face path direction86- `pathRotationOffset` -- number (degrees), added to auto-rotation8788## Common Patterns8990### Creating Paths with Chained Curves9192Path has convenience methods that create curves starting from the previous end point:9394```js95const path = this.add.path(100, 500);9697path.lineTo(300, 100); // straight line98path.cubicBezierTo(500, 100, 350, 50, 450, 50); // cubic bezier (endX, endY, cp1X, cp1Y, cp2X, cp2Y)99path.quadraticBezierTo(700, 400, 600, 100); // quadratic bezier (endX, endY, cpX, cpY)100path.splineTo([ // spline through points101 new Phaser.Math.Vector2(750, 300),102 new Phaser.Math.Vector2(600, 500)103]);104path.ellipseTo(50, 80, 0, 270, false, 0); // ellipse arc (xRadius, yRadius, startAngle, endAngle, clockwise, rotation)105path.circleTo(40); // shortcut for ellipseTo with equal radii and 0-360106107// Jump to a new position without drawing (creates a gap)108path.moveTo(400, 400);109path.lineTo(500, 400);110111// Close the path by connecting end to start112path.closePath();113```114115### Adding Standalone Curve Objects116117```js118const path = new Phaser.Curves.Path(0, 0);119120// Add pre-constructed curve objects121const line = new Phaser.Curves.Line(new Phaser.Math.Vector2(0, 0), new Phaser.Math.Vector2(200, 200));122path.add(line);123124const spline = new Phaser.Curves.Spline([ 200, 200, 300, 100, 400, 300 ]);125path.add(spline);126127const ellipse = new Phaser.Curves.Ellipse(400, 300, 100, 60, 0, 360, false, 0);128path.add(ellipse);129```130131### Getting Points Along a Path132133```js134// Array of points (uses defaultDivisions per curve)135const points = path.getPoints();136137// With explicit divisions per curve138const detailed = path.getPoints(32);139140// Equally spaced points along the entire path141const spaced = path.getSpacedPoints(100);142143// Single point at normalized position (0-1)144const midpoint = path.getPoint(0.5);145146// Tangent vector at a position147const tangent = path.getTangent(0.5);148149// Total path length in pixels150const length = path.getLength();151152// Bounding rectangle153const bounds = path.getBounds();154```155156### Drawing Paths with Graphics157158```js159const graphics = this.add.graphics();160161// Draw entire path162graphics.lineStyle(2, 0x00ff00, 1);163path.draw(graphics, 64); // 64 = points per curve for smoothness164165// Draw individual curves166graphics.lineStyle(1, 0xff0000, 1);167path.curves[0].draw(graphics, 32);168169// Draw debug points170const points = path.getSpacedPoints(50);171points.forEach(p => {172 graphics.fillStyle(0xffff00, 1);173 graphics.fillCircle(p.x, p.y, 3);174});175```176177### PathFollower Sprite178179```js180const path = this.add.path(100, 200);181path.lineTo(400, 400);182path.lineTo(700, 200);183184// Create follower185const enemy = this.add.follower(path, 100, 200, 'enemy');186187// Start following with config188enemy.startFollow({189 duration: 3000, // ms to traverse path190 positionOnPath: true, // snap to path start position191 rotateToPath: true, // auto-rotate to face direction192 rotationOffset: 90, // offset added to auto-rotation (degrees)193 repeat: -1, // -1 = infinite repeat194 yoyo: true, // reverse on each repeat195 from: 0, // start position on path (0-1)196 to: 1, // end position on path (0-1)197 startAt: 0, // initial seek position198 ease: 'Sine.easeInOut' // any valid Phaser ease199});200201// Control during playback202enemy.pauseFollow();203enemy.resumeFollow();204enemy.stopFollow();205enemy.isFollowing(); // returns boolean206207// Change path at runtime208enemy.setPath(newPath);209enemy.setPath(newPath, { duration: 2000 }); // auto-starts210211// Set rotation independently212enemy.setRotateToPath(true, 90); // (value, offsetDegrees)213```214215### PathFollower with Simple Duration216217```js218// Shorthand: pass just a duration number219enemy.startFollow(5000);220221// Equivalent to:222enemy.startFollow({ duration: 5000 });223```224225## All Curve Types226227| Curve | Class | Constructor Params | Description |228|---|---|---|---|229| Line | `Phaser.Curves.Line` | `(p0, p1)` Vector2 endpoints, or `([x0,y0,x1,y1])` | Straight line segment between two points |230| Spline | `Phaser.Curves.Spline` | `(points)` array of Vector2, flat numbers, or nested arrays | Catmull-Rom spline through control points |231| CubicBezier | `Phaser.Curves.CubicBezier` | `(p0, p1, p2, p3)` or `([x0,y0,...x3,y3])` | Cubic Bezier with start, 2 control points, end |232| QuadraticBezier | `Phaser.Curves.QuadraticBezier` | `(p0, p1, p2)` or `([x0,y0,...x2,y2])` | Quadratic Bezier with start, 1 control point, end |233| Ellipse | `Phaser.Curves.Ellipse` | `(x, y, xRadius, yRadius, startAngle, endAngle, clockwise, rotation)` or config object | Elliptical arc; angles in degrees; yRadius defaults to xRadius |234235### Ellipse Curve Properties236237The Ellipse curve has get/set properties for runtime modification:238- `x`, `y` -- center position239- `xRadius`, `yRadius` -- radii240- `startAngle`, `endAngle` -- in degrees (get/set convert to/from radians internally)241- `clockwise` -- boolean242- `rotation` -- in radians243- `angle` -- rotation in degrees (alternative to `rotation`)244- `setWidth(value)` / `setHeight(value)` -- sets radius to value/2245246## API Quick Reference247248### Path (`Phaser.Curves.Path`)249| API | Type | Description |250|---|---|---|251| `add(curve)` | method | Append any Curve to the path |252| `lineTo(x, y)` | method | Add a Line from current end point |253| `splineTo(points)` | method | Add a Spline from current end point |254| `cubicBezierTo(x, y, cp1X, cp1Y, cp2X, cp2Y)` | method | Add CubicBezier from current end point |255| `quadraticBezierTo(x, y, cpX, cpY)` | method | Add QuadraticBezier from current end point |256| `ellipseTo(xR, yR, start, end, cw, rot)` | method | Add Ellipse arc from current end point |257| `circleTo(radius, clockwise, rotation)` | method | Shortcut for ellipseTo with equal radii |258| `moveTo(x, y)` | method | Move end point without drawing (creates gap) |259| `closePath()` | method | Add Line from end to start if not already closed |260| `getPoint(t, out)` | method | Point at normalized position (0-1) on entire path |261| `getPoints(divisions, stepRate)` | method | Array of points, divisions per curve |262| `getSpacedPoints(divisions)` | method | Equidistant points along entire path |263| `getRandomPoint(out)` | method | Random point anywhere on the path |264| `getStartPoint(out)` | method | Path starting point |265| `getEndPoint(out)` | method | Path ending point |266| `getTangent(t, out)` | method | Unit tangent vector at position t |267| `getCurveAt(t)` | method | Return the Curve at normalized position t |268| `getLength()` | method | Total path length in pixels |269| `getCurveLengths()` | method | Array of cumulative curve lengths |270| `getBounds(out, accuracy)` | method | Bounding Rectangle |271| `draw(graphics, pointsTotal)` | method | Draw all curves onto a Graphics object |272| `toJSON()` / `fromJSON(data)` | method | Serialization |273| `updateArcLengths()` | method | Force recalculation of cached lengths |274| `destroy()` | method | Clear internal references |275276### Base Curve (`Phaser.Curves.Curve`)277| API | Type | Description |278|---|---|---|279| `getPoint(t, out)` | method | Point at parameter t (0-1) -- abstract, each subclass implements |280| `getPointAt(u, out)` | method | Point at arc-length position u (0-1) -- evenly spaced |281| `getPoints(divisions, stepRate, out)` | method | Array of points |282| `getSpacedPoints(divisions, stepRate, out)` | method | Equidistant points by arc length |283| `getDistancePoints(distance)` | method | Points spaced by pixel distance |284| `getLength()` | method | Total curve arc length |285| `getTangent(t, out)` / `getTangentAt(u, out)` | method | Unit tangent vector |286| `getTFromDistance(distance)` | method | Convert pixel distance to t value |287| `draw(graphics, pointsTotal)` | method | Render onto Graphics (default 32 points) |288| `getBounds(out, accuracy)` | method | Bounding Rectangle |289| `active` | `boolean` | When false, parent Path skips this curve |290| `defaultDivisions` | `number` | Default 5 for standalone curves |291| `arcLengthDivisions` | `number` | Precision for arc length calculations (default 100) |292293### PathFollower Component294| API | Type | Description |295|---|---|---|296| `setPath(path, config)` | method | Set a new Path (optionally auto-start) |297| `startFollow(config, startAt)` | method | Begin following; config = duration number or PathConfig |298| `pauseFollow()` | method | Pause movement |299| `resumeFollow()` | method | Resume paused movement |300| `stopFollow()` | method | Stop following |301| `isFollowing()` | method | Returns true if actively moving on path |302| `setRotateToPath(value, offset)` | method | Enable/disable auto-rotation with offset |303| `path` | `Path` | Current path reference |304| `pathTween` | `Tween` | Internal tween driving movement |305| `pathOffset` | `Vector2` | Offset from path coordinates |306| `pathVector` | `Vector2` | Current position on the path |307| `pathDelta` | `Vector2` | Movement delta since last update |308| `rotateToPath` | `boolean` | Auto-rotate to path direction |309| `pathRotationOffset` | `number` | Rotation offset in degrees |310311### PathConfig (`Phaser.Types.GameObjects.PathFollower.PathConfig`)312| Property | Type | Default | Description |313|---|---|---|---|314| `duration` | `number` | 1000 | Time in ms to traverse the path |315| `from` | `number` | 0 | Start position on path (0-1) |316| `to` | `number` | 1 | End position on path (0-1) |317| `positionOnPath` | `boolean` | false | Snap follower to path start on begin |318| `rotateToPath` | `boolean` | false | Auto-rotate to face path direction |319| `rotationOffset` | `number` | 0 | Degrees added to auto-rotation |320| `startAt` | `number` | 0 | Initial seek position on path (0-1) |321322The config also accepts all standard Tween properties: `ease`, `repeat`, `yoyo`, `delay`, `hold`, `onComplete`, etc.323324## Gotchas3253261. **`getPoint(t)` vs `getPointAt(u)` on curves.** `getPoint` uses the raw curve parameter t, which does not produce evenly spaced points on most curve types. `getPointAt` maps through arc length for even spacing. On a Path, `getPoint` already accounts for arc length across the whole path.3273282. **Path `moveTo` creates an inactive curve.** The `MoveTo` pseudo-curve has `active: false` and zero length. It only repositions the end point for the next curve. It does not draw anything and is skipped by `getPoints()` and `draw()`.3293303. **PathFollower uses a Tween internally.** The `startFollow` config is passed to `scene.tweens.addCounter()`. All tween properties (ease, delay, repeat, yoyo, callbacks) work. The tween is set to `persist: true` automatically.3313324. **PathFollower offset behavior.** When `positionOnPath: false` (default), the follower's current position becomes the offset from the path start. When `positionOnPath: true`, the follower snaps to the path's start point and the offset is zeroed.3333345. **Ellipse angles are in degrees.** The constructor and `startAngle`/`endAngle` properties accept degrees. Internally they are stored as radians. The `rotation` property is in radians, but `angle` is in degrees.3353366. **`closePath` vs `autoClose`.** `closePath()` adds an explicit Line curve from end to start. `autoClose = true` only affects `getPoints()` and `getSpacedPoints()` output by appending the first point, without adding a curve.3373387. **Cached lengths can go stale.** `getCurveLengths()` caches results based on array length only. If you modify a curve's control points, call `path.updateArcLengths()` to force recalculation.3393408. **`cubicBezierTo` parameter order with numbers.** When passing numbers: `cubicBezierTo(endX, endY, cp1X, cp1Y, cp2X, cp2Y)`. The end point comes first, not the control points. When passing Vector2 objects: `cubicBezierTo(cp1, cp2, endPoint)`.3413429. **Spline needs at least 4 points.** The Catmull-Rom interpolation used by Spline works best with 4+ points. With fewer points, the curve may not behave as expected.34334410. **Line curve `arcLengthDivisions` is 1.** Unlike other curves (default 100), Line overrides this to 1 since a line is inherently uniform. No need to adjust it.345346## Source File Map347348| File | Purpose |349|---|---|350| `src/curves/path/Path.js` | Path class -- combines multiple curves, factory registered as `this.add.path` |351| `src/curves/path/MoveTo.js` | MoveTo pseudo-curve for creating gaps in paths |352| `src/curves/Curve.js` | Base Curve class -- shared methods for all curve types |353| `src/curves/LineCurve.js` | Line curve (two-point segment) |354| `src/curves/SplineCurve.js` | Spline curve (Catmull-Rom through multiple points) |355| `src/curves/CubicBezierCurve.js` | Cubic Bezier curve (4 control points) |356| `src/curves/QuadraticBezierCurve.js` | Quadratic Bezier curve (3 control points) |357| `src/curves/EllipseCurve.js` | Ellipse/arc curve with angle and rotation support |358| `src/gameobjects/pathfollower/PathFollower.js` | PathFollower Game Object (extends Sprite + PathFollower mixin) |359| `src/gameobjects/pathfollower/PathFollowerFactory.js` | `this.add.follower` factory registration |360| `src/gameobjects/components/PathFollower.js` | PathFollower component mixin (setPath, startFollow, pathUpdate, etc.) |361| `src/gameobjects/pathfollower/typedefs/PathConfig.js` | PathConfig typedef |