PatternColor
PatternColor
Section titled “PatternColor”patternColor
一种图案颜色规范。您可以通过修改文档中的现有图案来创建新的图案颜色。对图案的任何修改都会影响调色板中的该图案。
PatternColor
对象可用于任何接受颜色对象的属性,例如 fillColor
或 strokeColor
。
PatternColor.matrix
Section titled “PatternColor.matrix”patternColor.matrix
由于操作路径而产生的额外变换。
PatternColor.pattern
Section titled “PatternColor.pattern”patternColor.pattern
对定义此颜色定义中使用的图案的图案对象的引用。
PatternColor.reflect
Section titled “PatternColor.reflect”patternColor.reflect
如果为 true
,则在填充之前应反射原型。
默认值:false
布尔值
PatternColor.reflectAngle
Section titled “PatternColor.reflectAngle”patternColor.reflectAngle
反射的轴,以点为单位。
默认值:0.0
数字(双精度)
PatternColor.rotation
Section titled “PatternColor.rotation”patternColor.rotation
在填充之前旋转原型图案的角度(以弧度为单位)。
默认值:0.0
数字(双精度)
PatternColor.scaleFactor
Section titled “PatternColor.scaleFactor”patternColor.scaleFactor
在填充之前缩放原型图案的比例,表示为一个包含水平和垂直缩放百分比的点。
包含 2 个数字的数组
PatternColor.shearAngle
Section titled “PatternColor.shearAngle”patternColor.shearAngle
倾斜的剪切角度(以弧度为单位)。
默认值:0.0
数字(双精度)
PatternColor.shearAxis
Section titled “PatternColor.shearAxis”patternColor.shearAxis
剪切所参考的轴,以点为单位。
默认值:0.0
数字(双精度)
PatternColor.shiftAngle
Section titled “PatternColor.shiftAngle”patternColor.shiftAngle
在填充之前平移未缩放原型图案的角度(以弧度为单位)。
默认值:0.0
数字(双精度)
PatternColor.shiftDistance
Section titled “PatternColor.shiftDistance”patternColor.shiftDistance
在填充之前平移未缩放原型图案的距离(以点为单位)。
默认值:0.0
数字(双精度)
PatternColor.typename
Section titled “PatternColor.typename”patternColor.typename
引用对象的类名。
字符串;只读。
修改和应用图案颜色
Section titled “修改和应用图案颜色”// 旋转当前文档中每个图案的颜色,// 然后将最后一个图案应用于第一个路径项if (app.documents.length > 0 && app.activeDocument.pathItems.length > 0) { var doc = app.activeDocument; var swatchIndex = 0;
for (i = 0; i < doc.swatches.length; i++) { // 获取色板的通用颜色对象 var currentSwatch = doc.swatches[i]; var swatchColor = currentSwatch.color;
// 仅对图案进行操作 if (currentSwatch.color.typename == "PatternColor") { // 更改图案属性 currentSwatch.color.rotation = 10; swatchIndex = i; } }
// 将最后一个图案颜色色板应用于最前面的路径 var firstPath = app.activeDocument.pathItems[0]; firstPath.filled = true; firstPath.fillColor = doc.swatches[swatchIndex].color;}