微信小程序中调用scale方法,小程序对横纵坐标进行缩放

发布时间:2023-07-19 05:01:55 作者:wysuperman 阅读量:9092

 

canvasContext.scale


定义

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

参数

参数 类型 说明
scaleWidth Number 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%)
scaleHeight Number 纵坐标轴缩放的倍数 (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()
更多微信小程序开发教程,可以关注多程序。
***本网站图片,文字之类版权申明,因为网站可以由注册用户自行上传图片或文字,本网站无法鉴别所上传图片或文字的知识版权,如果侵犯,请及时通知我们,本网站将在第一时间及时删除。

我要评论

秒制作
Catfish(鲶鱼) Blog V 4.7.3