Core guide

Paths and polygons

Build reusable polygon fills and curved stroke geometry from copied input data.

Live example

See Paths and polygons in action

See a curved stroke and polygon fill prepared from reusable geometry.

live rendering loading ticks 0

How it works

Path and polygon constructors copy caller data. Updates validate before replacing geometry, and handles remain scoped to the game that created them.

Public types

  • PathHandle
  • PolygonHandle
  • FlattenedSubpath
  • TriangulatedPolygon
  • GeometryHandle

Minimum viable example

const route = create_path([move_to(0, 0), quadratic_to(40, -30, 80, 0)]);
const marker = create_polygon([{ x: 0, y: 0 }, { x: 40, y: 0 }, { x: 20, y: 30 }]);
route.update([move_to(0, 0), line_to(100, 20)]);

Scope and limitations

Holes, fill rules, and filled curved paths are Phase 3 candidates.