How to mask a dom element in createjs

405 views Asked by At

I am trying to mask a dom element in createjs . but masking is not working with dom element in createjs

var stage;

function init() {
    stage = new createjs.Stage("my_canvas");

    var de = new createjs.DOMElement(document.getElementById("page"));
    stage.addChild(de);

    var shape = new createjs.Shape();
    shape.graphics.beginFill('#000').drawRect(0, 0, 100, 100);
    stage.addChild(shape);
    de.mask = shape;

    stage.update();
}  
1

There are 1 answers

0
sebastian.derossi On

@AshishKumar

I am afraid you will not be able to do this since DOMElement class doesn't actually render to the Canvas. All it does is it transforms the target element within the DOM. Moving the x/y position for instance.

Sorry for the late response.