module:RadialGradient

module:RadialGradient

Radial-gradient class
radial-gradient demo

Constructor

# new module:RadialGradient(positionDefinition, radius, colorStops)

Radial-gradient constructor

Parameters:
Name Type Description
positionDefinition PositionDefinition

Center of the gradient

radius Number

Radius of the gradient

colorStops Object

Set of colors to go through (key is position [from 0 to 1], value is the color)

Example
new RadialGradient(from, radius, { 0: "red", 1: "green" });

Methods

# toString(ctx) → {CanvasGradient}

Return a drawing context compatible gradient

Parameters:
Name Type Description
ctx CanvasRenderingContext2D

Drawing context

Returns:
Type
CanvasGradient