Skip to content

AvatarBook

The avatars the frames said, by player id, and the smoothed bodies. One per game page.

new AvatarBook(now?): AvatarBook

now: this frame’s time (tests).

() => number

AvatarBook

readonly smoothedBody: SmoothedBody

A player’s smoothed body (see Play.smoothedBody): a frame’s body smoothed for its player and interpolated for this animation frame, or a player id’s (null if none yet).

get defaultAmount(): number

The smoothing amount when the game gives none (true or absent): 0.5, or LOCAL_SMOOTHING for local bodies.

number

setLocal(local): void

Bodies from a camera on this same device (true) or over the network (false, the default): the lighter smoothing and interpolation, or the usual. Players start afresh.

boolean

void


note(players, t?, arrival?): void

Every frame from the host: the latest avatar of each player, and when their bodies were taken (t).

readonly PlayerFrame[]

number

number

void


of(player): string

The avatar id of a player (an id, 1-based, or a frame): the one the child picked, or the default of the slot (fox, lion, dragon, unicorn: the 6–8 band’s, as no age is known here) before the first frame, from an older host, or for an id this SDK doesn’t know.

number | PlayerFrame

string


posed(player, body, amount, interpolate?): Body

The body to draw for this player now: body smoothed (amount below 1) against the player’s previous one, then, with interpolate, at this animation frame’s time between the last two.

number

Body

number

boolean

Body


smooth(player, body, amount): Body

body smoothed against this player’s previous one; the same body twice in a row is smoothed once.

number

Body

number

Body


takeDrawn(): number

Animation frames the avatars were drawn in, since the last call; for stats. Frames are told apart by their time, so any number of avatars or calls in one frame count once.

number