简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM