canvascontext.rotate(number angle)
支付宝客户端 支持
支小宝客户端 支持
安诊儿客户端 支持
主体: 企业支付宝小程序 、 个人支付宝小程序
相关文档: 旧版 canvas 迁移指南 、
旋转当前坐标轴。
旋转中心点为原点,可使用 方法修改原点位置。多次调用 rotate
,将在上次旋转结果的基础上再次旋转。
``` js
const ctx = my.createcanvascontext('canvas')
ctx.strokerect(120, 20, 100, 50)
// 顺时针旋转 60 度
ctx.rotate(60 * math.pi / 180)
ctx.strokerect(120, 20, 100, 50)
// 逆时针旋转 30 度
ctx.rotate(-30 * math.pi / 180)
ctx.strokerect(120, 20, 100, 50)
ctx.draw()
```
- id: axml
标题: .axml
``` html
```