微信小程序开发 专题
专题目录
您的位置:微信小程序开发 > 微信小程序开发专题 > 在微信小程序中调用scale方法对横纵坐标进行缩放
在微信小程序中调用scale方法对横纵坐标进行缩放
作者:--    发布时间:2019-11-20


定义

在调用scale方法后,之后创建的路径其横纵坐标会被缩放。多次调用scale,倍数会相乘。

参数

参数类型说明
scalewidthnumber横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%)
scaleheightnumber纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%)

例子

const ctx = wx.createcanvascontext('mycanvas')

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()


网站声明:
本站部分内容来自网络,如您发现本站内容
侵害到您的利益,请联系本站管理员处理。
联系站长
373515719@qq.com
关于本站:
编程参考手册