Reputation: 1
I am working with fabric.js and I have used a fabric.Text class like this:
var text = new fabric.Text('hello world', {
fontSize: 30,
left:190,
});
var circle = new fabric.Circle({
radius: 100,
fill: '#eef',
scaleY: 0.5
});
var group = new fabric.Group([ text, circle ], {
left: 150,
top: 100,
angle: -10
});
canvas.add(rect1, rect2, rect3, circle, triangle,group);
canvas.on({
'object:moving': onChange,
'object:scaling': onChange,
'object:rotating': onChange,
});
function onChange(options) {
options.target.setCoords();
canvas.forEachObject(function(obj) {
if (obj === options.target)
return;
obj.setOpacity(options.target.intersectsWithObject(obj) ? 0.5 : 1);
});
}
The main problem is that I can not modify the value of the text of the text class dynamically. How I can modify it?
Upvotes: 0
Views: 1613