Canvas area lifecycle

Product media placeholder

Replace this area with a screenshot or short walkthrough video during the media sweep.

Canvas lifecycle issues usually come from missing mounts, zero-size containers, stale listeners, route transitions, hidden tabs, or assets that are not ready when rendering starts.

Lifecycle phases

  • Resolve the mount or headless output.
  • Load assets: media, fonts, paths, spritesheets, and textures.
  • Create parameters, data tables, inputs, graph nodes, state machines, and renderer resources.
  • Start or pause playback according to scene timeline, page state, and visibility.
  • Dispose on route, modal, section, or preview teardown.

Sizing rules

  • width and height are authored pixel dimensions.
  • viewport.responsive, fit, alignment, minScale, and maxScale determine how the render adapts.
  • A visible Canvas should never rely on a zero-size mount. Check computed size in browser verification.

Runtime controls

  • play() starts Canvas timelines and media playback where applicable.
  • pause() pauses Canvas timelines and media playback where applicable.
  • dispose() releases graph, listener, renderer, asset, and state-machine resources held by the load result.

Verified runnable example

This guide points to proof-backed sample coverage. The full ledger lives in Generated examples and proof log.

Canvas: Fill rule diagnostic

  • Source: faster-motion/demo/tests/canvas/fillrule-diagnostic/fillrule-diagnostic.fmtion
  • Expected output: A contained Canvas scene renders paired path cases so nonzero and evenodd fill handling can be compared visually.
  • Validation: Schema validation passed. Runtime proof reports zero blocking runtime issues and 10 rendered objects; the accepted metadata note is preserved in the proof ledger.
  • Desktop proof: generated-assets/faster-motion-docs/proofs/screenshots/canvas-fillrule-diagnostic-desktop.png
  • Mobile proof: generated-assets/faster-motion-docs/proofs/screenshots/canvas-fillrule-diagnostic-mobile.png

Guide-specific sample target: Lifecycle sample that loads, plays, pauses, resizes, disposes, and remounts without duplicate listeners or blank frames.

Faster Motion docs

Use this local map together with the left navigation. The source-backed content tree controls the main article order; this section keeps related pages one click away.

Start

DOM animation

Canvas animation

3D and procedural

Reference

Was this guide helpful?