初面网初面网

变换

变换是基于原点的。

  • translate
  • rotate
  • scale
ctx.translate(100,100);
ctx.rotate(45* Math.PI/4);
ctx.scale(2,2);

ctx.fillRect(0,0,100,100);

transform

包含位移、旋转、缩放于一体

transform(a,b,c,d,e,f)

水平缩放,垂直倾斜,水平倾斜,垂直缩放,水平移动,垂直移动

更新于 2025/2/26