Skip to main content

Function: drawScene()

drawScene(ctx, scene, opts?): object

Defined in: packages/sporty/src/canvas.ts:49

Paints scene at the origin of ctx and returns the size drawn, in the caller's current units. Give width (default 800, like toSVG; the height follows the aspect), width and height (the scene is fitted into the box, like toSVG's viewBox, and the returned size is the fitted one), or scale (px per unit; the box size follows). The scene transform composes with the caller's (a HiDPI ctx.scale(dpr, dpr) survives) and the context is restored afterwards. Throws InputError when the scene's bbox is empty (the custom leagues of some sports).

Parameters​

ctx​

SceneCanvasContext

scene​

Scene

opts?​

DrawSceneOptions = {}

Returns​

object

height​

height: number

scale​

scale: number

width​

width: number