I'm attempting to build a rectangle with a linear gradient fill using code similar to:
const gradient = new LinearGradient({
stops: [
new GradientStop({
color: "gray",
offset: 0,
opacity: 0
}),
new GradientStop({
offset: 0.5,
color: "orange",
opacity: 0.8
})]
});
const geometry = new GeomRectangle([0, 0], [100, 25]);
const rect = new Rect(geometry, {
stroke: { color: "black", width: 1 },
fill: { color: gradient, opacity: 1 } <- Compile error wants string
});
However, in the TypeScript FillOptions definition, color is defined as string. I can't find an example in the Kendo docs that describe how this might work. I'd be grateful for any insights.
You can pass the gradient directly to the "fill" option of both a Path or a Rect:
EXAMPLE