我在其他示例中看到所有人都在图像中应用此过滤器...
我的问题是知道我是否可以在形状中应用模糊滤镜:
我证明这一点并且不起作用
window.onload = function(){
function writeMessage(message) {
text.setText(message);
layer.draw();
}
var stage = new Kinetic.Stage({
container: 'container',
width: 3600,
height: 1600
});
var layer = new Kinetic.Layer();
var shape = new Kinetic.Path({
x: 200,
y: 0,
data:'m306,316.36069l36.11703,39.66971l8.47302,-43.01529l60.22296,32.44058l-19.99786,-42.15051l78.43591,22.03604l-32.51349,-63.15952l80.97086,-69.52588l-84.47522,39.46899l119.7962,-83.01416l-131.73438,66.88934l42.73438,-33.11069l-59.7962,18.98587l103.47522,-105.53102l-120.97086,95.47411l107.51349,-175.1595l-143.43591,162.03607l-20.00214,-86.15053l-17.22296,85.44057l-98.47302,-148.01527l74.88297,148.66971l-65.11703,-68.66971l41.52701,73.01527l-126.22301,-106.44057l80.99785,116.15053l-61.43588,-46.03607l40.5135,56.1595l-150.97088,-117.47411l138.4752,130.53102l-107.7962,-45.98587l90.73441,63.11069l-53.73441,-9.88934l50.7962,31.01416l-67.4752,43.53101l88.97088,-9.47412l-46.5135,37.15952l78.43588,-22.03604l-19.99785,42.15051l60.22301,-32.44058l8.47299,43.01529l36.11703,-39.66971z',
fill:'rgba(255,197,0,0.4)',
stroke:'rgba(255,132,23,0.00)',
// shadowColor:'rgb(255,132,23)',
// shadowBlur : 156
filter: Kinetic.Filters.Blur,
blurRadius: 20
});
layer.add(shape);
stage.add(layer);
答案 0 :(得分:0)
我找到了解决方案...... 我写了这段代码并且有效:
shape.cache({
x : -5,
y : -5,
width : 500,
height : 500
});
shape.filters([Kinetic.Filters.Blur]); //nothing happens
shape.blurRadius(30);