如何從底部中心角度用 HTML5 canvas 元素旋轉影像?
將影像尺寸設為 32, 120 −
context.translate(32, 120);
現在旋轉畫布 −
context.rotate(90 * Math.PI/180);
現在繪製圖像 −
context.drawImage(img, -32, -120, 64, 120);
廣告
將影像尺寸設為 32, 120 −
context.translate(32, 120);
現在旋轉畫布 −
context.rotate(90 * Math.PI/180);
現在繪製圖像 −
context.drawImage(img, -32, -120, 64, 120);