DebugCanvas Component
Events
- DebugDraw
- when the entity is ready to be drawn to the stage
- NoCanvas
- if the browser does not support canvas
When this component is added to an entity it will be drawn by the DebugCanvas layer.
Crafty.debugCanvas.init() will be automatically called if it is not called already to initialize the canvas element.
To visualise an object's MBR, use "WiredMBR" or "SolidMBR". To visualise a "Collision" object's hitbox, use "WiredHitBox" or "SolidHitBox". To visualize an entity's click area, use "WiredAreaMap" or "SolidAreaMap".
See Also
Methods
Back to top
.debugAlpha()
public .debugAlpha(Number alpha)
- alpha
The alpha level the component will be drawn with
Back to top
.debugFill()
public .debugFill([String fillStyle])
- fillStyle
The color the component will be filled with. Defaults to "red". Pass the boolean false to turn off filling.
Example
var myEntity = Crafty.e("2D, Collision, SolidHitBox ").debugFill("purple")
Back to top
.debugStroke()
public .debugStroke([String strokeStyle])
- strokeStyle
The color the component will be outlined with. Defaults to "red". Pass the boolean false to turn this off.
Example
var myEntity = Crafty.e("2D, Collision, WiredHitBox ").debugStroke("white")