Skip to content

phoria2 1.2.0

Choose a tag to compare

@kevinroast kevinroast released this 01 Nov 20:27
· 197 commits to main since this release

phoria2 1.2.0

Highlights

  • Accessibility. keyboard: true on a View lets people Tab to the canvas and step through what
    can be hovered or clicked with the arrow keys: bars, points, surface grid points, network nodes
    and links, or furniture. Each item shows its highlight and tooltip as hover would, and Enter
    clicks it. A screen reader hears each one ("North, Sales: 26. 1 of 48") and a description of the
    view, which charts write for themselves.
  • Reduced motion. Views follow the system's prefers-reduced-motion setting: frame() glides
    jump, auto-rotation holds, and chart transitions and flowing links settle at once.
  • Works with physics, CSG and path-finding libraries. Four new integration demos draw
    Rapier (rigid bodies and soft-body cloth),
    Manifold and
    recast-navigation, and the API gained
    a number of nice additions to support this (below).

Added

  • View
    • keyboard: true | { label: (hit) => text }: keyboard and screen-reader use. Off by default.
      Its code loads on first use.
    • description: what the view shows, for screen readers (the canvas's label).
    • reducedMotion: 'auto' | true | false: defaults to 'auto', which follows the system setting.
      view.reducedMotion says whether motion is reduced, for checking in animation of your own.
    • view.framing(target, { padding, direction }): where frame() would put the camera, without
      moving it, for a camera that eases after something moving.
  • Charts: chart.summary(), one sentence describing the chart for screen readers. A spec's
    description overrides it.
  • Nodes: highlight: false keeps a node and its children untinted under a View that tints
    everything (null still means "use the View's").
  • Instances
    • An instance scaled to 0 is hidden: it's left out of bounds, framing, culling, shadows and labels.
    • Rotations can be given as { x, y, z, w } objects (QuatInput), as physics engines return
      them.
  • Lights: DirectionalLight.shadowBounds fixes the area a directional light's shadow map
    covers.
  • Labels
    • minScale: a label appears only once you've zoomed in that far.
    • Instance labels can be given as lists.
    • LabelStats.zoomedOut counts the labels hidden by zoom.
    • New Raycaster.solids() and raycaster.blocked() make hiding labels behind geometry much
      cheaper: 17.4 ms down to 0.78 ms a frame in the periodic table demo.
  • Geometry: normals that phoria2 works out itself are worked out again after needsUpdate(),
    so geometry edited in place (cloth, waves) shades correctly as it moves. Normals you supply are
    kept.
  • view.explain() reports accessibility settings.

Fixed

  • Directional shadows no longer flicker or shimmer as things or the camera move: the shadow map now
    snaps to whole texels.
  • Orbiting to look straight down no longer turns the picture 90° in the last degree.

Performance

  • Colour strings are parsed once and remembered, and setInstance / setColor no longer create a
    new colour object each call.

Demos and docs

  • New demos
    • Periodic table.
    • An Integrations section: physics (a brick tower and bombs, with Rapier), cloth (Rapier soft
      bodies), CSG (Manifold) and path finding (recast-navigation).
  • Keyboard on in the existing demos: the chart demos and the office planner.
  • Docs
    • Getting started tutorial: a first scene, then a
      live dashboard of 3D charts.
    • The README covers interaction, working with other libraries and accessibility.
    • llms-full.txt and the Claude Code plugin's reference cover the new API.

Upgrading

npm install phoria2@1.2.0, or pin phoria2@1.2.0 in a CDN import map.