V2 presentation modes

Historical reference for kinematic animation and physical simulation in the published v2.

This article documents the published v2. For the current physics preview, see the v3 guide. V3 ↗ Licenses ↗

This page covers the published v2. Set mode on the viewer and optionally override it for each display() or displayTimeline() call. For new projects and this site’s interactive tools, use v3 physics only.

kinematic physics
Default Yes No
Havok/WASM Not loaded Loaded on demand
Die, floor, and wall collisions No Yes
Motion Directed arc and spin toward the supplied face Throw, gravity, and guided settling
Typical use Lightweight overlays and larger groups Tactile rolls with impacts
await viewer.display({
  id: 'physical-1',
  seed: 'animation-1',
  mode: 'physics',
  dice: [{ id: 'd20', sides: 20, value: 17 }]
})

Kinematic

This is the default. Dice enter from one shared edge, spin freely through most of the path, and orient to the supplied face near the end. There are no physical collisions. duration controls the base time and delay staggers entry. The same seed reproduces visual paths, positions, and rotations.

Physics

The renderer loads Havok and havok/HavokPhysics.wasm. Each die enters through a portal outside the visible area, receives linear and angular velocity, and collides with dice, floor, and walls. A preflight uses the already resolved face to plan motion; the simulation settles the body without drawing a new result. onCollision receives { action: 'collision', body0Id?, body1Id?, force }.

seed fixes initial visual conditions, but physical timing and contact can vary. gravity, throwForce, spinForce, friction, restitution, linearDamping, angularDamping, and settleTimeout tune presentation. aggressiveThrowChance controls the chance of a higher-energy throw; it does not promise a wall collision. wallBounceChance is a deprecated alias.

Responsive stage and limit

Both modes recalculate the playable area on resize. wallPadding, spawnSpacing, spawnHeightStep, and spawnOverscan control margins and entry. maxDice counts visual bodies: d2–d20 use one; each d100 uses two. Its default is 120 bodies.

See Configuration for v2 defaults. The playground uses v3 physics only.