CanvasContext.scale
2020-09-14 15:18 更新
简介
CanvasContext.scale 用于在调用scale方法后,之后创建的路径其横纵坐标会被缩放。多次调用scale,倍数会相乘。
扫码体验

效果示例

示例代码
//.js
const ctx = my.createCanvasContext('canvas');
ctx.strokeRect(10, 10, 25, 15)
ctx.scale(2, 2)
ctx.strokeRect(10, 10, 25, 15)
ctx.scale(2, 2)
ctx.strokeRect(10, 10, 25, 15)
ctx.draw()
ctx.draw()
入参
Object 类型,属性如下:
| 属性 | 类型 | 描述 |
|---|---|---|
| scaleWidth | Number | 横坐标缩放倍数 (1 = 100%,0.5 = 50%,2 = 200%)。 |
| scaleHeight | Number | 纵坐标轴缩放倍数 (1 = 100%,0.5 = 50%,2 = 200%)。 |
以上内容是否对您有帮助:

免费 AI IDE


更多建议: