【发布时间】:2016-07-03 19:32:00
【问题描述】:
我正在尝试使用画架JS 为单行添加模糊效果。我一直在关注 createJS 文档中的 BlurFilter 演示(除了他们使用的是圆圈而不是线条)。除非我删除 shape.cache 调用,否则我的形状会完全消失。这可能是一条线还是仅限于形状的模糊?
function drawShape() {
var shape = new createjs.Shape();
shape.graphics.setStrokeStyle(10, "round")
.beginStroke(colorPalette.shape[0])
.beginFill(colorPalette.shape[0])
.moveTo(200,400)
.lineTo(1500,400);
shape.cursor = "pointer";
var blurFilter = new createjs.BlurFilter(50, 50, 1);
shape.filters = [blurFilter];
var bounds = blurFilter.getBounds();
shape.cache(-50+bounds.x, -50+bounds.y, 100+bounds.width, 100+bounds.height); // Code works if I remove this line
updateStage(shape); // Utility function that calls addChild and update on stage
}
<body onload="init()" onresize="resize()">
<!-- App -->
<canvas id="canvas"></canvas>
</body>
【问题讨论】:
标签: javascript createjs easeljs