Search code examples
javascripthtmlcachingfilterkineticjs

How To: Kinetic.js cached shape filter


Kinetic.js doc reference tells us following:

cache node to improve drawing performance, apply filters, or create more accurate hit regions

But when i try to cache custom shape and apply some filters to it as following

shape.cache();
shape.filters([Kinetic.Filters.Brighten]); //nothing happens
shape.filterBrightness(100); //this even throws error: Shape doesn't have this method at all

So is there any way to apply some sort of filter/shadow/blur/stroke to cached shape?


Solution

  • Look at documantation if you can't find some methods: http://kineticjs.com/docs/

    rect.brightness(0.5);
    

    Demo: http://jsbin.com/fucix/1/edit