← The API

Phaser AE

API docs

v3.0.0-2206 exports in 26 modulesreleased October 19, 2026

ContentsCurves

Need to get started? Install the Phaser AE CLI →

Content and maths

Curves

Catmull–Rom: a span in any dimension (uniform, centripetal or chordal), the scalar form for value curves, and an arc-length spline through points

engine/kernel/src/curves.ts

Functions

catmullRom

function catmullRom(p0: CurvePoint, p1: CurvePoint, p2: CurvePoint, p3: CurvePoint, t: number, alpha = 0.5, out: number[] = []): number[]

From @phaser-ae/kernel

One point of the span from p1 (t = 0) to p2 (t = 1), shaped by p0 before it and p3 after it. Every point has the same number of coordinates. Written into out when given (and returned), so a hot loop allocates nothing.

catmullRom1

function catmullRom1(a: number, b: number, c: number, d: number, t: number): number

From @phaser-ae/kernel

The scalar span, uniform: for a value curve over time, such as a size or an alpha across a particle's life.

createSpline

function createSpline(points: ReadonlyArray<CurvePoint>, options: SplineOptions = {}): Spline

From @phaser-ae/kernel

Make a spline through points (at least two, all with the same number of coordinates). See SplineOptions.

Types

CurvePoint

type CurvePoint = ReadonlyArray<number>

From @phaser-ae/kernel

A point as plain coordinates: [x, y], [x, y, z], or any length, the same for every point of a curve.

Spline

interface Spline

From @phaser-ae/kernel

A spline through a list of points, sampled by arc length, so at(0.5) is halfway along it, not halfway through its points.

  • readonly points: ReadonlyArray<CurvePoint> — The points it passes through.
  • readonly closed: boolean — Whether it joins the last point back to the first.
  • readonly length: number — Its length, measured along the curve (from the arc-length table, so a close approximation).
  • at(u: number, out?: number[]): number[] — The point a fraction u (0..1) of the way along, by arc length. A closed spline wraps u; an open one clamps it.
  • atDistance(d: number, out?: number[]): number[] — The point d units along the curve from its start.
  • tangent(u: number, out?: number[]): number[] — The unit direction of travel a fraction u of the way along.
  • locate(u: number): { span: number; t: number } — Which span a fraction u falls in, and how far through that span: points[span] to the next.

SplineOptions

interface SplineOptions

From @phaser-ae/kernel

How a spline through a list of points is built.

  • closed?: boolean — Join the last point back to the first. Default false.
  • alpha?: number — Knot spacing: 0 uniform, 0.5 centripetal (default), 1 chordal.
  • ends?: 'mirror' | 'clamp' — How an open spline treats its ends, which have no neighbour beyond them: 'mirror' (default) reflects the second point through the first, so the curve leaves the end along the line to its neighbour; 'clamp' repeats the end point, so the curve eases into it.
  • samples?: number — Samples per span for the arc-length table. Default 16; more for long, tight curves.