# CanvasGradient.addColorStop(number stop, string color)

with Promise style call: Not supported

Mini Program plugin: Not supported

Adds a gradient point for the color. Less than minimum stop The part of the stop of color To render, greater than the maximum stop The part of the stop of color To render

# parameter

# number stop

Represents the position between the start and end of a gradient, the range 0-1。

# string color

The color of the gradient point.

# sample code

const ctx = wx.createCanvasContext('myCanvas')

// Create circular gradient
const grd = ctx.createLinearGradient(30, 10, 120, 10)
grd.addColorStop(0, 'red')
grd.addColorStop(0.16, 'orange')
grd.addColorStop(0.33, 'yellow')
grd.addColorStop(0.5, 'green')
grd.addColorStop(0.66, 'cyan')
grd.addColorStop(0.83, 'blue')
grd.addColorStop(1, 'purple')

// Fill with gradient
ctx.setFillStyle(grd)
ctx.fillRect(10, 10, 150, 80)
ctx.draw()