人。我使用easeljs-0.8.0.js绘制一条线,但它不起作用,你能帮助我吗?
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="lib/easeljs-0.8.0.js"></script>
</head>
<body>
<canvas id="demoCanvas" width="1200" height="600"></canvas>
</body>
<script>
window.onload = function() {
var canvas = document.getElementById("demoCanvas");
var stage = new createjs.Stage(canvas);
var lineShape = new createjs.Shape();
lineShape.graphics.moveTo(10,10).setStrokeStyle(1).beginStroke("#ff0000").lineTo(50,50);
stage.addChild(lineShape);
stage.update();
}
</script>
</html>
我无法用上面的代码画一条线!!!
答案 0 :(得分:2)
在0.8.0中,图形引擎被重写,您现在需要在moveTo
,beginStroke
或beginFill
后调用beginStrokeStyle
,因为这些方法和#34 ;重置&#34;路径。