[英]How To: Kinetic.js cached shape filter
Kinetic.js doc reference tells us following: Kinetic.js文档参考告诉我们以下内容:
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/ 如果找不到某些方法,请查看documantation: http ://kineticjs.com/docs/
rect.brightness(0.5);
Demo: http://jsbin.com/fucix/1/edit 演示: http : //jsbin.com/fucix/1/edit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.