I am using fabricjs for canvas. I want to have blur effect for the background image. I could show the blur effect but not based on user value as i did not understand the algorithm. Also it takes some second to show the blur effect and is also not so strong.
I did this way
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));
}
How do i show the blur effect based on user provided value?