function drawScreen() {
context.save();
context.setTransform(1,0,0,1,0,0);
var angleInRadians=45*Math.PI/180;
var x=100;
var y=100;
var width=50;
var height=50;
context.translate(x +.5*width,y +.5*height);
context.scale(2,2);
context.rotate(angleInRadians);
context.fillStyle="red";
context.fillRect(-0.5*width,-0.5*height,width,height);
context.restore();
context.fillStyle="blue";
context.fillRect(100,100,50,50);
}
Canvas缩放和旋转的组合
最新推荐文章于 2023-10-12 16:08:59 发布