小程序画布填充一个矩形CanvasContext.fillRect
CanvasContext.fillRect(number x, number y, number width, number height)
填充一个矩形。用 setFillStyle 设置矩形的填充色,如果没设置默认是黑色。
小程序插件:支持
参数
number x
矩形路径左上角的横坐标
number y
矩形路径左上角的纵坐标
number width
矩形路径的宽度
number height
矩形路径的高度
示例代码
const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.fillRect(10, 10, 150, 75)
ctx.draw()
- 小程序画布创建一条弧线CanvasContext.arc
- CanvasContext.arc(number x, number y, number r, number sAngle, number eAngle, boolean counterclockwise)
- 04-14 关注:3