Skip to content
Kitbay
Skill

curves-and-paths

MITUpdated on Aug 21, 202640,693GitHub stars

A reference skill published in the Phaser game framework's own repository for building and using curves and paths in Phaser 4.

What the skill teaches

A reference skill published in the Phaser game framework's own repository for building and using curves and paths in Phaser 4. It explains that a path joins several curves, which need not touch, and covers lines, Catmull-Rom splines, cubic and quadratic Bezier curves and ellipse arcs, the shared methods for sampling points, lengths, bounds and tangents, the builder methods such as lineTo, splineTo and moveTo, and drawing a path with Graphics. It also covers path followers, sprites that move along a path through an internal tween, with rotation and offset options. A list of pitfalls covers uneven spacing from getPoint, mixed angle units on ellipses and lengths that go stale after edits.

Capabilities

  • Build paths from lines, splines and Bezier curves
  • Sample evenly spaced points along a curve
  • Make sprites follow a path
  • Draw paths with Graphics