The type of the options the application in the sandbox will be constructed with.
Construct a new CanvasSandbox
.
The window we're running inside.
The canvas node we're drawing to.
The canvas implementation you want to use in this sandbox. see Canvas2D and Canvas3D.
The application that is going to run in the sandbox.
The canvas that the application will receive.
The options that will be passed to the application.
The options that the application should be constructed with.
Optional
sandboxOptions: Partial<CanvasSandboxOptions>The options for the sandbox itself.
Readonly
applicationThe application running inside the sandbox.
Readonly
canvasOur convenience canvas wrapper, which we provide to the application to render to.
Readonly
canvasThe canvas node that we're drawing into.
Readonly
documentThe document the sandbox is interacting with.
Readonly
renderThe render loop we use to control frame rendering.
Readonly
sandboxThe options for this sandbox.
Readonly
shakeOur handler for device shaking.
Readonly
windowThe window the sandbox is running in.
The
CanvasSandbox
provides a scaffold to quickly perform experiments with aHTMLCanvasElement
in a document. Common functionality for such experiments is implemented in the sandbox already.Example
main.ts
index.html