Is there a way to apply an image filter to a text object in js j. I use an image filter to hide border content and I need to apply it to a text object. but the image object does not have the ability to apply filters.
var textn = new fabric.Text('Hello world', {
fill: 'black',
left: canvas.width/2,
top: canvas.height/2
})
canvas.add(textn);
textn.cloneAsImage(function(pgClone) {
pgClone.set({ left: canvas.width/2, top: canvas.height/2, 'djtext':$('#addText').val() });
canvas.add(pgClone);
canvas.setActiveObject(pgClone);
canvas.renderAll();
});
canvas.remove(textn);
canvas.renderAll();
I tried the method cloneAsImage. It works, but whenever I want to change a text object, I need to create text elements again.
source
share