My question seems relatively easy, but after a couple of hours googling I don't get any more info about that.
Basically I would like to use the animate function to move the center of two triangles (or one to start with) around another triangle. I guess it should represents an animation in three steps but I can't get something working.
Note that it's the first time I use it, I'm afraid it may sound obvious for some of you.
Also I am not sure I have set up things properly (based on example and only animating one property) as the animation doesn't want to fire up :/
function createTriangle() {
var canvas2 = new fabric.Canvas('myCanvas');
var triangle = new fabric.Triangle({
width: 300, height: 300, fill: 'red', left: 30, top: 0
});
triangle.animate('top', '200', {
duration: 1000,
onChange: canvas2.renderAll.bind(canvas2),
onComplete: function() {
//callback code goes here
}
});
canvas2.add(triangle);
}
Anyone has an idea why it is not working?
Thanks