Crafty.canvas

Collection of methods to draw on canvas.

Methods and Properties

Back to top

Crafty.canvas._canvas

Main Canvas element

Back to top

Crafty.canvas.context

This will return the 2D context of the main canvas element. The value returned from Crafty.canvas._canvas.getContext('2d').

Back to top

Crafty.canvas.init

public void Crafty.canvas.init(void)

Events

NoCanvas
triggered if `Crafty.support.canvas` is false

Creates a canvas element inside Crafty.stage.elem. Must be called before any entities with the Canvas component can be drawn.

This method will automatically be called if no Crafty.canvas.context is found.