createjs mask不起作用(Uncaught TypeError:无法设置属性'props'为null)

时间:2015-02-23 01:00:00

标签: mask createjs

我运行此代码时出现此错误 未捕获的TypeError:无法设置null的属性'props' 任何人都可以提供帮助

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="https://code.createjs.com/createjs-2014.12.12.min.js"></script>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>


<script>


var stage = new createjs.Stage("canvas");
createjs.Ticker.addEventListener("tick", tick);

var ui = new Image();
ui.onload = drawShape();
ui.src = "A09.png";

//每次勾选重绘形状。     function drawShape(){    //面具     var shape = new createjs.Shape();     shape.graphics = new createjs.Graphics()     .beginStroke( “RGBA(255,255,255,1)”)     .beginBitmapFill(ui).drawCircle(35,25,20).endStroke();

var image = new createjs.Bitmap(ui);
image.mask = shape;

stage.addChild(image);
console.log("draw");
}
function tick(event) {
stage.update();
}
</script>
</body>
</html>

0 个答案:

没有答案