CreateRadialGradientFill
创建径向渐变填充,使用所选径向渐变作为对象背景应用于对象。
语法
expression.CreateRadialGradientFill(gradientStops);
expression - 表示 Api 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| gradientStops | 必需 | number[] | 以千分之一百分比度量的渐变颜色光圈数组。 |
返回值
示例
在文档中创建径向渐变填充。
// Create the fill object which represents a radial gradient fill and apply it to the created shape in a document.
// Create a radial gradient fill from an array of the gradient color stops and use it as a background for the shape class 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.CreateRadialGradientFill([gs1, gs2]);
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = Api.CreateShape("rect", 5930900, 395605, fill, stroke);
paragraph.AddDrawing(shape);