CreateGradientStop
创建用于不同类型渐变的渐变光圈。
语法
expression.CreateGradientStop(color, pos);
expression - 表示 Api 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| color | 必需 | ApiColor | 用于渐变光圈的颜色。 | |
| pos | 必需 | PositivePercentage | 以千分之一百分比度量的渐变光圈位置。 |
返回值
示例
定义渐变填充的颜色点并将其应用于文档中的形状。
// How do I set specific colors at positions along a gradient used on a shape in a document?
// Build a two-color gradient by placing color markers at the start and end of the fill range in a document.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let gs1 = Api.CreateGradientStop(Api.RGB(255, 213, 191), 0);
let gs2 = Api.CreateGradientStop(Api.RGB(255, 111, 61), 100000);
let fill = Api.CreateLinearGradientFill([gs1, gs2], 5400000);
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = Api.CreateShape("rect", 5930900, 395605, fill, stroke);
paragraph.AddDrawing(shape);