Promotic
WikipediaLinkedInYoutubeTwitterFacebook

addColorStop - method of object CanvasCtx

Description:
The method specifies the color and position in a gradient object
Syntax:
addColorStop(stop As Long, color As String) As Object
Calling:
gradient.ctx.addColorStop(stop,color);
Parameters:
stop(Long) Value (range 0.0 - 1.0) represents the position between start and end of the gradient
color(String) A CSS specification color value valid for the stop position
Note:
The method can also be called in the graphic item events for Web Panels.
Example1:
var grd = ctx.createLinearGradient(20, 20, 60, 40);
grd.addColorStop(0, "black");
grd.addColorStop(1, "white");
ctx.fillStyle = grd;
Example2:
Example of color gradient of 3 colors with transparency
var grd = ctx.createLinearGradient(20, 20, 60, 40);
grd.addColorStop(0, "rgba(0,0,0,0.2)");
grd.addColorStop(0.3, "rgba(255,0,0,0.2)");
grd.addColorStop(1, "rgba(255,255,255,0.2)");
ctx.fillStyle = grd;
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice