📜  javascript 旋转图像画布 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:00.533000             🧑  作者: Mango

代码示例1
function drawRotated(degrees){
    context.clearRect(0,0,canvas.width,canvas.height);
    context.save();
    context.translate(canvas.width/2,canvas.height/2);
    context.rotate(degrees*Math.PI/180);
    context.drawImage(image,-image.width/2,-image.width/2);
    context.restore();
}