DebugCanvas 组件

Events

DebugDraw
当实体将要绘制到舞台时触发
NoCanvas
当浏览器不支持 canvas 时触发

当此组件添加到实体时,实体将会被绘制在调试层上。

Crafty.debugCanvas.init() 将会自动执行,如果你没有在初始化 canvas 元素时调用的话。

要观察对象的最小外接矩形, 使用 "VisibleMBR". 要观察 "碰撞" 对象的碰撞盒子,使用 "WiredHitBox" 或者 "SolidHitBox".

方法

Back to top

.debugAlpha()

public .debugAlpha(Number alpha)
alpha

指定alpha级别的组件将会被绘制

Back to top

.debugFill()

public .debugFill([String fillStyle])
fillStyle

组件将会使用颜色填充,默认为 "red",通过传递 false 可以关闭此特性。

例子

var myEntity = Crafty.e("2D, Collision, SolidHitBox ").debugFill("purple")
Back to top

.debugStroke()

public .debugStroke([String strokeStyle])
strokeStyle

组件将会有一个带颜色的边框,默认为“red”,通过传递 false 可以关闭此特性。

例子

var myEntity = Crafty.e("2D, Collision, WiredHitBox ").debugStroke("white")