Dokumentasi pembangunan applet WeChat
/ 微信小程序API 繪圖對坐標軸進行順時針旋轉
微信小程序API 繪圖對坐標軸進行順時針旋轉
rotate
定義
以原點為中心,原點可以用 translate方法修改。順時針旋轉當前坐標軸。多次調用rotate
,旋轉的角度會疊加。
參數(shù)
const ctx = wx.createCanvasContext('myCanvas') ctx.strokeRect(100, 10, 150, 100) ctx.rotate(20 * Math.PI / 180) ctx.strokeRect(100, 10, 150, 100) ctx.rotate(20 * Math.PI / 180) ctx.strokeRect(100, 10, 150, 100) ctx.draw()