Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program API drawing, setting the fill style setFillStyle


May 19, 2021 WeChat Mini Program Development Document


Table of contents


WeChat small program API drawing, setting the fill style setFillStyle Drawing interfaces and methods


canvasContext.setFillStyle


Defined

Set the fill color.

Tip : If fillStyle the default color is black

Parameters

Parameters Type Defined
color Color Gradient Object Fill color

Example

const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.fillRect(10, 10, 150, 75)
ctx.draw()

WeChat small program API drawing, setting the fill style setFillStyle

WeChat small program API drawing, setting the fill style setFillStyle Drawing interfaces and methods