CreateRadialGradient Method
Class THtml5Canvas2D
function CreateRadialGradient(x0, y0, r0, x1, y1, r1: Double): TCanvasRadialGradient;
The CreateRadialGradient method creates a radial/circular gradient object. The gradient can be used to fill rectangles, circles, lines, text, etc.
Tip:
Use the
AddColorStop method to specify different colors, and where to position the colors in the gradient object.
Tip:
Parameter Values
The x-coordinate of the starting circle of the gradient.
The y-coordinate of the starting circle of the gradient.
The radius of the starting circle.
The x-coordinate of the ending circle of the gradient.
The y-coordinate of the ending circle of the gradient.
The radius of the ending circle.
Example:
Draw a rectangle and fill with a radial/circular gradient:
var
Gradient: TCanvasRadialGradient;
Gradient := Canvas.CreateRadialGradient(75,50,5,70,60,100);
Gradient.AddColorStop(0,clRed);
Gradient.AddColorStop(1,clWhite);
Canvas.FillStyle := Gradient;
Canvas.FillRect(0,0,150,100);