關(guān)于旋轉(zhuǎn)的原點講錯了,應(yīng)該是這樣:
cxt.translate(x,y); //移動 canvas 和它的原點到(x,y)
cxt.rotate(rot/180 * Math.PI); //以原點(x,y)為中心旋轉(zhuǎn) canvas
cxt.scale(R,R); //放大(因為R>1)圖形在 canvas 中的像素數(shù)目
cxt.translate(x,y); //移動 canvas 和它的原點到(x,y)
cxt.rotate(rot/180 * Math.PI); //以原點(x,y)為中心旋轉(zhuǎn) canvas
cxt.scale(R,R); //放大(因為R>1)圖形在 canvas 中的像素數(shù)目
2018-08-09
已采納回答 / 韓俠
context.moveTo和context.lineTo是函數(shù), 調(diào)用方式不對context.moveTo(10,10);context.lineTo(800,800);這樣把等號去掉就好了
2018-06-04
最新回答 / corner_sun
可以啊在畫那個元素之前設(shè)置就行,之后恢復(fù)就行