Log inGet started
Package

crashReadouts.package

This package holds more than this page lists. See all of its files in its world.

README.md

readouts

require("crashReadouts.readouts"): the pure display half of crashReadouts. It turns a crash test's CrashResult into a widget tree in one of eight styles, and ships the drawing helpers those styles are made of. Nothing here measures or derives a crash number; it formats what the result holds.

  • Readouts.styles(): { { id, name, description, tags } } for the 8 styles.
  • Readouts.render(style, result, { w, h, t?, points? }): widget tree sized w × h. t is seconds since shown and drives the entrance (rows cascading, traces sweeping in, the stamp landing). Leave it out for the settled look. points = { car = {x,y,visible}, head = {x,y,visible} } places the floating labels (UI canvas points).
  • Readouts.layout(style, screenW, screenH, anchor?): where a style wants to sit: { x, y, w, h, sheet?, full? }.
  • Readouts.sample(opts?): a believable CrashResult with traces (speedKmh, car, dummy, belt, obstacle).
  • Readouts.rows(result): the readouts as { key, label, short, value, unit } rows, already formatted.
  • Helpers other UIs can reuse: traceSvg(result, opts) (grid + polylines + glow + peak cursors + axis labels), sevenSegSvg(text, opts) (seven-segment digits with ghost segments), starsSvg(n, opts), bodySvg(result, opts) (occupant silhouette coloured by rating).

Called by the ReadoutPanel component in the same package, and by any screen that wants to embed a readout as a child node.