CreateJS / EaselJS

The Easel Javascript library provides a full, hierarchical display list, a core interaction model, and helper classes to make working with the HTML5 Canvas element much easier.

Home Page:http://createjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to make webgl mask work in animation?

ajex-china opened this issue · comments

commented

Is it possible to make webgl mask work in animation?

Yes,

  1. add the mask to the container.
  2. cache teh container
  3. call .updateCache() from the container on every change.

Example:

let maskContainer = new createjs.Container();
...
let mask = new createjs.Shape();
mask.graphics.drawRect(0,0, sizeX, sizeY);
maskContainer.mask = mask;
....
maskContainer.addChild(scrollcontentContainer);
....
maskContainer.cache( 0, 0, sizeX, sizeY);
...
//On every change
maskContainer.updateCache();