Create a canvas layer object
pos Vector2 optionalWorld space position of the layer
size Vector2 optionalWorld space size of the layer
angle number optional, default 0Angle the layer is rotated by
renderOrder number optional, default 0Objects sorted by renderOrder
canvasSize Vector2 optionalDefault size of canvas, can be changed later
useWebGL boolean optional, default trueShould this layer use WebGL for rendering
const canvasLayer = new CanvasLayer(vec2(), vec2(200,100));
The canvas used by this layer
The 2D canvas context used by this layer
Texture info to use for this object rendering
Destroy this canvas layer
immediate boolean optional, default falseRemove it now, as EngineObject.destroy does, children included
Draw this canvas layer centered in world space
pos Vector2Center in world space
size Vector2 optionalSize in world space
color Color optionalColor to modulate with
angle number optional, default 0Angle to rotate by
mirror boolean optional, default falseIf true the image is flipped left to right
additiveColor Color optionalAdditive color to be applied if any
screenSpace boolean optional, default drawScreenSpaceIf true the pos and size are in screen space
context CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D optionalCanvas 2D context to draw to
Check if this layer is using WebGL
Create WebGL texture if necessary and copy layer canvas to it