Skip to content

Stdlib

The stdlib is intentionally small. Hosts extend it; the core stays narrow.

  • std.shapesrect, circle, ellipse, path, image
  • std.texttext.glyph(string, font, size?) returning a 2D path
  • std.compose — layer stacking, blend modes, masks
  • std.filterblur(radius), color_grade, masks
  • std.mesh3dextrude(path, depth) plus the transform postfix methods .rotate(x/y/z: Angle), .translate(...), .scale(...), and .material(fill, metalness?, roughness?, emissive?)
  • std.lightingambient(intensity), directional(from, intensity), point(at, intensity)
  • std.scene3drender3d(mesh, lights, camera?) projects a 3D scene to a 2D Layer so it can be composed with 2D layers. Camera defaults to a sensible perspective; pass camera: perspective(fov: 28deg) or orthographic(...) to override.
  • std.animanimate { ... } keyframes; modifiers with { easing, repeat, … } where repeat: <Int> | forever; helpers wave(amplitude, period), noise(seed, period), easings, splines
  • std.color — perceptual mixing, gamut mapping, helpers around the oklch / oklab / srgb literals built into the grammar
  • std.transport — playhead, time, frame, tempo
  • std.audio — FFT, envelope follow, beat/onset detection, sample reading

Every function is tagged pure or effectful. Pure functions are safe to call from any context. Effectful functions (asset loading, audio analysis on a file, clock reads) require an explicit capability passed in. The type system enforces the split.

A scene’s render output is deterministic if every function it calls is pure — which is the whole point of the CanvasKit backend.

Status: not started. See Roadmap stage 3.