Canvas Element and masks
Hello
Recently I came across problem as I was trying to create animated mask and apply it to a jpeg that was inside movieclip
since I didn't want to make animation on timeline. I decided that I wil use createjs for creating the mask and GSAP to animate it. as seen below
var maskSize = 20;
var maskCont = new createjs.Container();
for (var posY = 0; posY < 250; posY +=maskSize) {
for (var posX = 0; posX < 300; posX +=maskSize) {
var tile = new createjs.Shape(new createjs.Graphics().beginFill("#000000").drawRect(-1*maskSize/2,-1*maskSize/2,maskSize,maskSize));
tile.x = posX + maskSize/2;
tile.y = posY + maskSize/2;
maskCont.addChild(tile);
}
}
for (var i = 0; i < maskCont.children.length; i++) {
var maskSquare = maskCont.children;
var targetx = Math.floor(Math.random()*100 - 50);
var targety = Math.floor(Math.random()*80 - 30);
var j = maskCont.children.length - i;
mainTl.to(maskSquare, .5, {scaleX:0, scaleY:0, x:"+="+targetx, y:"+="+targety},((j*.002)+1.2) );
}
Can anyone tell me is it possible to apply the container with animation, maskCont to a movieclip on a stage, if not directly, is there somekind of workaround ?
Thanks for help in advance
