在 EaselJS 中更改形状的移动点

Change movement point of a shape in EaselJS

所以,我在想是否可以在 EaselJS 中移动形状的移动点。例如-

这是一张正方形的图片。可怕的蓝点代表方块移动发生的点。换句话说,当我告诉形状去点 (0, 0) 时,它会将那个点移动到那个位置。

我最近开始使用 EaselJS 和 CreateJS 库,所以我真的不知道我是否可以这样做 - 我想将移动点更改为中心,就像 EaselJS 中的圆圈一样。

当我将一个圆移动到点(0, 0)时,我只能看到圆的四分之一,因为圆心已经移动到(0, 0)。但是,当我将它移动到 (0, 0) 时,我可以看到整个正方形。有什么办法可以改变这个点,以便在将它移动到 (0, 0) 时能够看到整个圆圈或正方形的一部分?

您可以从中心绘制形状,或设置 regXregY

// Draw from center
var s = new createjs.Shape();
s.graphics.beginFill("black").drawRect(-50,-50,100,100);

// Set registration point
var s = new createjs.Shape();
s.graphics.beginFill("black").drawRect(0,0,100,100);
s.regX = s.regY = 50; // Set the registration to half the width & height

希望对您有所帮助。