为什么我的形状没有添加到舞台上?
Why are my shapes not added to the stage?
我正在使用 CreateJS 画一条线。只要是 "CreateJS 2013.09.25" 引用即可。线条绘制如预期。
到目前为止我一直在使用这个:
<script src="https://code.createjs.com/createjs-2015.05.21.min.js"></script>
问题在于此参考线根本没有绘制,这与绘制得很好的所有其他形状不同。这是我画线的代码:
function CreateLine(x,y,length) {
var line = new createjs.Shape();
line.graphics.moveTo(x, y).setStrokeStyle(2).beginStroke("#003300").lineTo(x + length, y);
stage.addChild(line);
}
//After that I do update the stage!
我目前使用的src不是新的吗?这是为什么?
我能够重现您的问题。我不确定现在是否是设计使然,但需要在设置笔划样式并开始笔划后调用 moveTo。
line.graphics.setStrokeStyle(2).beginStroke("#003300").moveTo(x, y).lineTo(x + length, y);
我正在使用 CreateJS 画一条线。只要是 "CreateJS 2013.09.25" 引用即可。线条绘制如预期。
到目前为止我一直在使用这个:
<script src="https://code.createjs.com/createjs-2015.05.21.min.js"></script>
问题在于此参考线根本没有绘制,这与绘制得很好的所有其他形状不同。这是我画线的代码:
function CreateLine(x,y,length) {
var line = new createjs.Shape();
line.graphics.moveTo(x, y).setStrokeStyle(2).beginStroke("#003300").lineTo(x + length, y);
stage.addChild(line);
}
//After that I do update the stage!
我目前使用的src不是新的吗?这是为什么?
我能够重现您的问题。我不确定现在是否是设计使然,但需要在设置笔划样式并开始笔划后调用 moveTo。
line.graphics.setStrokeStyle(2).beginStroke("#003300").moveTo(x, y).lineTo(x + length, y);