Skip to content

AvatarRenderer

createAvatarRenderer’s result: avatars drawn on a canvas of their own.

readonly renderer: Renderer

The renderer in use: a GL one is replaced by Canvas 2D (on a fresh canvas) after 3 s of context loss.


readonly kind: RendererKind

Its kind: ‘webgl2’, ‘webgl1’ or ‘canvas2d’.


readonly lost: boolean

The GL context is lost right now (nothing is drawn until it comes back, or Canvas 2D takes over).


readonly canvas: HTMLCanvasElement

The canvas drawn in: after a switch to Canvas 2D a fresh one, in the old one’s place in the page.

draw(players, box): void

Clears the canvas and draws each player’s avatar, posed like their body (smoothed and interpolated per player unless the options say not), with its name tag. box: where player space (0–1) lands, in drawing units. Call it every animation frame.

readonly AvatarPlayer[]

AvatarBox

void


clear(): void

An empty canvas (nothing to draw this frame).

void


reset(): void

Forget the players’ previous bodies (a new scene).

void


destroy(): void

Frees the renderer and its textures.

void