我正在尝试使用类似于以下的代码构建具有线性渐变填充的矩形:
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
});
但是,在 TypeScript FillOptions定义中,颜色被定义为字符串。我在 Kendo 文档中找不到描述这可能如何工作的示例。我将不胜感激任何见解。