A live-view host. Attach one with engine.attachCanvas().
Methods#
attach()?#
optional attach(surface): void;Called once when the canvas is attached.
Parameters#
| Parameter | Type |
|---|---|
surface |
FrameSurface |
Returns#
void
beforeUpdate()#
beforeUpdate(surface): void;Before update(): size the surface and request a frame.
Parameters#
| Parameter | Type |
|---|---|
surface |
FrameSurface |
Returns#
void
afterUpdate()#
afterUpdate(info, surface): void;After update(): present the frame, if one was produced.
Parameters#
| Parameter | Type |
|---|---|
info |
FrameInfo |
surface |
FrameSurface |
Returns#
void
requestFrame()#
requestFrame(tick, busy): object;Schedule the next tick. Engine time advances only inside update(), so waiting on input alone freezes playback.
Parameters#
| Parameter | Type |
|---|---|
tick |
() => void |
busy |
boolean |
Returns#
object
detach()?#
optional detach(): void;Called once when the canvas is detached or the engine is disposed.
Returns#
void