How to create WeChat Mini Programs linear gradient
This article mainly introduces the relevant knowledge of how to create WeChat Mini Programs linear gradient, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to create WeChat Mini Programs linear gradient. Let's take a look.
CanvasContext.createLinearGradient definition
Create a linear gradient color.
Tip: you need to use addColorStop () to specify gradient points, at least two.
The parameter type defines the x coordinate of the x0Number start point, the y coordinate of the y0Number start point, the y coordinate of the x coordinate y1Number end point, const ctx = wx.createCanvasContext ('myCanvas') / / Create linear gradientconst grd = ctx.createLinearGradient (0,0,200,0) grd.addColorStop (0,' red') grd.addColorStop (1, 'white') / / Fill with gradientctx.setFillStyle (grd) ctx.fillRect (10,10,150) 80) this is the end of the article ctx.draw () on "how to create WeChat Mini Programs's linear gradient". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to create WeChat Mini Programs linear gradient". If you want to learn more, you are welcome to follow the industry information channel.