How to change the image of the fabric.Image object attribute src?

前端 未结 3 515
生来不讨喜
生来不讨喜 2021-02-13 17:23

How can I change the image of the fabric.Image object attribute src, if I have already made an animation?

3条回答
  •  长发绾君心
    2021-02-13 17:52

    You can use setSrc():

    var activeObject = canvas.getActiveObject();
    activeObject.setSrc('images/my-image.png', function(img) {
        canvas.add(img);
    });
    

提交回复
热议问题