# CanvasGradient CanvasContext.createCircularGradient(number x, number and number r)

with Promise style call: Not supported

Mini Program plugin: Support

Create a circular gradient color. The starting point is in the center of the circle and the ending point is the circle. ReturnedCanvasGradientThe object needs to use the CanvasGradient.addColorStop() To specify gradient points, you need at least two.

# parameter

# number x

Centroid x coordinate

# number and

Centroid and coordinate

# number r

Radius of a circle

# Return value

# CanvasGradient

# sample code

const ctx = wx.createCanvasContext('myCanvas')

// Create circular gradient
const grd = ctx.createCircularGradient(75, 50, 50)
grd.addColorStop(0, 'red')
grd.addColorStop(1, 'white')

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