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

WeChat small program drawing API canvas drawing text


May 19, 2021 WeChat Mini Program Development Document


Table of contents


Drawing interfaces and methods

canvasContext.fillText


Defined

Draws the filled text on the canvas.

Parameters

string text

The text output on the canvas

number x

The top left corner x coordinate position of the drawing text

number y

Draws the y coordinate position in the upper left corner of the text

number maxWidth

The maximum width that needs to be drawn is optional

Example

const ctx = wx.createCanvasContext('myCanvas')

ctx.setFontSize(20)
ctx.fillText('Hello', 20, 20)
ctx.fillText('MINA', 100, 100)

ctx.draw()

WeChat small program drawing API canvas drawing text

WeChat small program drawing API canvas drawing text Drawing interfaces and methods