Search code examples
javascriptkineticjs

Kineticjs apply Mask filter to a layer


How can we apply Mask filter to a layer. Official documentation shows this:

node.cache();
node.filters([Kinetic.Filters.Mask]);
node.threshold(0.1);

But it is not working.


Solution

  • layer.cache();
    layer.threshold(260);
    layer.filters([Kinetic.Filters.Mask]);
    layer.draw();
    

    DEMO: http://jsbin.com/luyola/1/edit?js,output