织物图像在fabric js 2.4.6版中不起作用

时间:2019-02-06 13:14:54

标签: fabricjs

我无法使用fabric将图像添加到画布。在2.4.6版的fabric中,图像或imagefromurl。

<html>
<head>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.4.6/fabric.js"></script>
</head>

<body>
 <canvas id="c" width=400 height=300></canvas>
</body>

</html>
<script>
 var canvas = new fabric.Canvas('c');
 var url = 'driver.png';
 var imgInstance = new fabric.Image(url, {
  left: 100,
  top: 100,
  width: 200,
  height: 200
 });
 canvas.add(imgInstance);
</script>

0 个答案:

没有答案