createjs mask 填坑过程

createjs 的mask必须使用 shape  (不算坑)

作为遮罩的shape不能被 addChild  (上一次 自己居然躲过了,这次被巨坑)

var S=this;
var shape = new createjs.Shape();
shape.graphics.f("#FF0000").s().p("AkCKYQhcifgZkAQgyjvgEjaQgDg3gpgyQgSgGgQACQgQADgQAIIiUBBQgeAOg8gwQgng6ADgyQAvhOB1ANQAzAFBZAxQBlhdBHgxQAwgtA0gXQA1g2gDg1QAdgXAMAeIBjBhQAdAVAagWIBNhxQAiglAnAdQBNAkAtAlQB9BVBABSQBUAlAfgkQCWg7AUAKQAxAKALA4QAGAdhKBFQg8BLhBAAQhAAAh2hdQAFIZgRDuIgmBwQgzB9gcATQheBNi9AZQjagLhDhDg");
shape.setTransform(87.4,84.7); var ld = new createjs.LoadQueue(false)
ld.addEventListener("fileload", loadedF);
ld.addEventListener("complete", loadComF);
function loadedF(e)
{
if (e.item.type == "image")
{
var img = new createjs.Bitmap(e.result)
img.scaleX=/img.image.width;
img.scaleY=/img.image.height;
img.x=img.y=; S.addChild(img)
img.mask=shape };
}
function loadComF(e)
{
}
ld.loadFile("testImg.jpg")
上一篇:Luogu P1312 Mayan游戏(搜索)


下一篇:NOIP2011玛雅游戏