autonomous-ai/openharness/curves-and-paths
Claude Code and agent skill by autonomous-ai/openharness
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install autonomous-ai/openharness/curves-and-pathsSKILL.md
The same SKILL.md was published earlier as phaserjs/phaser/curves-and-paths.
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
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 ofPhaser.Curves.Curveobjects in the PathstartPoint--Vector2, the defined starting positionautoClose-- boolean, if truegetPoints()appends the first point at the enddefaultDivisions-- number (default: 12), divisions per curve when callinggetPoints()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 parameterizationgetPointAt(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 curvegetSpacedPoints(divisions, stepRate, out)-- array of equidistant points by arc lengthgetDistancePoints(distance)-- points spaced by pixel distancegetLength()-- total arc length in pixelsgetBounds(out, accuracy)-- bounding RectanglegetTangent(t, out)/getTangentAt(u, out)-- unit tangent vectorgetStartPoint(out)/getEndPoint(out)-- first/last pointsgetRandomPoint(out)-- random point on the curvedraw(graphics, pointsTotal)-- render the curve onto a Graphics objectactive-- 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-- thePhaser.Curves.Pathbeing followedpathTween-- the internal Tween driving movementpathOffset--Vector2, offset added to path coordinatespathVector--Vector2, current position on the pathpathDelta--Vector2, distance traveled since last framerotateToPath-- boolean, auto-rotate to face path directionpathRotationOffset-- 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:
Adding Standalone Curve Objects
Getting Points Along a Path
Drawing Paths with Graphics
PathFollower Sprite
PathFollower with Simple Duration
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 positionxRadius,yRadius-- radiistartAngle,endAngle-- in degrees (get/set convert to/from radians internally)clockwise-- booleanrotation-- in radiansangle-- rotation in degrees (alternative torotation)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) |
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingstore/agents/phaser/skills/curves-and-paths/SKILL.md
Popularity
- Repository stars
- 1,068
- Repository forks
- 89
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (Cursor)
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/autonomous-ai/openharness/curves-and-paths)