我正在为画布使用fabricjs。我想对背景图像进行模糊效果。我可以显示模糊效果,但不是基于用户价值,因为我不了解算法。也需要一些时间来显示模糊效果,也不是那么强。
我是这样做的
applyBlur(e) {
const object = this.state.canvas.backgroundImage;
object.filters[0] = new fabric.Image.filters.Convolute({
matrix: [ 1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36,
1/36, 1/36, 1/36 ]
});
object.applyFilters(this.state.canvas.renderAll.bind(this.state.canvas));
}
如何根据用户提供的值显示模糊效果?