图案
app.activeDocument.patterns
文档中的 Pattern 对象集合。
Patterns.length
Section titled “Patterns.length”app.activeDocument.patterns.length
集合中的元素数量。
数字;只读。
Patterns.parent
Section titled “Patterns.parent”app.activeDocument.patterns.parent
对象的容器。
对象;只读。
Patterns.typename
Section titled “Patterns.typename”app.activeDocument.patterns.typename
对象的类名。
字符串;只读。
Patterns.add()
Section titled “Patterns.add()”app.activeDocument.patterns.add()
创建一个新对象。
Patterns.getByName()
Section titled “Patterns.getByName()”app.activeDocument.patterns.getByName(name)
获取集合中具有指定名称的第一个元素。
参数 | 类型 | 描述 |
---|---|---|
name | 字符串 | 要获取的元素的名称 |
Patterns.index()
Section titled “Patterns.index()”app.activeDocument.patterns.index(itemKey)
从集合中获取一个元素。
参数 | 类型 | 描述 |
---|---|---|
itemKey | 字符串, 数字 | 字符串或数字键 |
Patterns.removeAll()
Section titled “Patterns.removeAll()”app.activeDocument.patterns.removeAll()
删除集合中的所有元素。
无。
// 从当前文档中删除最后一个图案。if (app.documents.length > 0) { var lastIndex = app.activeDocument.patterns.length - 1;
var patternToRemove = app.activeDocument.patterns[lastIndex]; var patternName = patternToRemove.name; patternToRemove.remove();
// 注意:删除 Illustrator 对象后,将引用已删除对象的变量设置为 null,因为它现在无效。 patternToRemove = null;}