module:ConicGradient

Conic-gradient class
conic-gradient demo

Constructor

new module:ConicGradient(positionDefinition, startAngle, colorStops)

Conic-gradient constructor

Parameters:
NameTypeDescription
positionDefinitionPositionDefinition

Center of the gradient

startAngleNumber

Starting angle (0 is top, 0.5 is bottom and 1 is full circle back to top)

colorStopsObject

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

Example
new ConicGradient(center, 0, { 0: "red", 0.25: "orange", 0.5: "yellow", 0.75: "green", 1: "blue" });

Methods

toString(ctx) → {CanvasGradient}

Return a drawing context compatible gradient

Parameters:
NameTypeDescription
ctxCanvasRenderingContext2D

Drawing context

Returns:
Type: 
CanvasGradient