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

WeChat small programs use the lineTo method to add a new point


May 19, 2021 WeChat Mini Program Development Document


Table of contents


WeChat small programs use the lineTo method to add a new point Drawing interfaces and methods

canvasContext.lineTo


Defined

lineTo method adds a new point and then creates a line from the last specified point to the target point.

Tip: Draw stroke() method

Parameters

Parameters Type Description
Number The x coordinates of the target location
Y Number The y coordinates of the target location

Example

const ctx = wx.createCanvasContext('myCanvas')
ctx.moveTo(10, 10)
ctx.rect(10, 10, 100, 50)
ctx.lineTo(110, 60)
ctx.stroke()
ctx.draw()

WeChat small programs use the lineTo method to add a new point

WeChat small programs use the lineTo method to add a new point Drawing interfaces and methods