如何用Canvas js中的图像替换形状?

时间:2015-07-24 01:42:17

标签: javascript image canvas litterallycanvas.js

我正在尝试用图像文件替换下面的椭圆形状。

/* this is the image variable I'm trying to use to replace the shape*/
var img = new Image();
img.addEventListener('load', function(e) {
    canvas.drawImage(this, 0, 0, 400, 400);
}, true);
img.src="img/crystal.png";

/* this is circle shape I'm trying to replace*/

    stroke(0);
    fill(175);
    ellipse(xpos, ypos, 32, 32);
}

0 个答案:

没有答案