arc里面的内容报错,不知道为什么
var image = new Image();
// 设置剪辑区域
var clippingRegion = {x:400,y:200,r:50};
image.src = 'body.jpg';
image.onload = function(e){
initCanvas()
};
function initCanvas(){
draw(image);
};
function setClippingRegion(clippingRegion){
context.beginPath();
context.arc(clippingRegion.x , clippingRegion.y , clippingRegion.r , 0 , Math.PI*2 , false);
context.clip();
}
function draw(image,clippingRegion){
context.clearRect(0, 0, canvas.width, canvas.height);
context.save();
setClippingRegion(clippingRegion);
context.drawImage(image, 0, 0);
context.restore();
}