图层
app.activeDocument.layers[index]
Illustrator 文档中的一个图层。图层可能包含嵌套的图层,这些嵌套的图层在用户界面中称为子图层。
layer
对象包含特定图层中的所有页面项作为元素。
您的脚本可以将页面项作为 Layer
对象的元素或 Document 对象的元素进行访问。当将页面项作为图层的元素访问时,只能访问该图层中的对象。要访问整个文档中的页面项,请确保将它们作为文档的一部分进行引用。
Layer.artworkKnockout
Section titled “Layer.artworkKnockout”app.activeDocument.layers[index].artworkKnockout
此对象是否用于创建挖空效果,如果是,是哪种挖空效果。您不能将此值设置为 KnockoutState.Unknown
。
Layer.blendingMode
Section titled “Layer.blendingMode”app.activeDocument.layers[index].blendingMode
合成对象时使用的模式。
Layer.color
Section titled “Layer.color”app.activeDocument.layers[index].color
图层的选择标记颜色。
Layer.compoundPathItems
Section titled “Layer.compoundPathItems”app.activeDocument.layers[index].compoundPathItems
此图层中包含的复合路径项。
CompoundPathItems; 只读。
Layer.dimPlacedImages
Section titled “Layer.dimPlacedImages”app.activeDocument.layers[index].dimPlacedImages
如果为 true
,则此图层中的置入图像应显示为暗淡。
布尔值。
Layer.graphItems
Section titled “Layer.graphItems”app.activeDocument.layers[index].graphItems
此图层中包含的图表项。
GraphItems; 只读。
Layer.groupItems
Section titled “Layer.groupItems”app.activeDocument.layers[index].groupItems
此图层中包含的组项。
GroupItems; 只读。
Layer.hasSelectedArtwork
Section titled “Layer.hasSelectedArtwork”app.activeDocument.layers[index].hasSelectedArtwork
如果为 true
,则此图层中的某个对象已被选中;设置为 false
以取消选择该图层中的所有对象。
布尔值。
Layer.isIsolated
Section titled “Layer.isIsolated”app.activeDocument.layers[index].isIsolated
如果为 true
,则此对象是隔离的。
布尔值。
Layer.layers
Section titled “Layer.layers”app.activeDocument.layers[index].layers
此图层中包含的图层。
Layers; 只读。
Layer.legacyTextItems
Section titled “Layer.legacyTextItems”app.activeDocument.layers[index].legacyTextItems
此图层中的旧版文本项。
LegacyTextItems; 只读。
Layer.locked
Section titled “Layer.locked”app.activeDocument.layers[index].locked
如果为 true
,则此图层可编辑;设置为 false
以锁定该图层。
布尔值。
Layer.meshItems
Section titled “Layer.meshItems”app.activeDocument.layers[index].meshItems
此图层中包含的网格项。
MeshItems; 只读。
Layer.name
Section titled “Layer.name”app.activeDocument.layers[index].name
此图层的名称。
字符串。
Layer.nonNativeItems
Section titled “Layer.nonNativeItems”app.activeDocument.layers[index].nonNativeItems
此图层中的非本地艺术项。
Layer.opacity
Section titled “Layer.opacity”app.activeDocument.layers[index].opacity
图层的不透明度。
范围:0.0 到 100.0。
数字(双精度)。
Layer.pageItems
Section titled “Layer.pageItems”app.activeDocument.layers[index].pageItems
此图层中包含的页面项(所有艺术项类)。
Layer.parent
Section titled “Layer.parent”app.activeDocument.layers[index].parent
包含此图层的文档或图层。
Layer.pathItems
Section titled “Layer.pathItems”app.activeDocument.layers[index].pathItems
此图层中包含的路径项。
PathItems; 只读。
Layer.placedItems
Section titled “Layer.placedItems”app.activeDocument.layers[index].placedItems
此图层中包含的置入项。
PlacedItems; 只读。
Layer.pluginItems
Section titled “Layer.pluginItems”app.activeDocument.layers[index].pluginItems
此图层中包含的插件项。
PluginItems; 只读。
Layer.preview
Section titled “Layer.preview”app.activeDocument.layers[index].preview
如果为 true
,则应使用预览模式显示此图层。
布尔值。
Layer.printable
Section titled “Layer.printable”app.activeDocument.layers[index].printable
如果为 true
,则在打印文档时应打印此图层。
布尔值。
Layer.rasterItems
Section titled “Layer.rasterItems”app.activeDocument.layers[index].rasterItems
此图层中包含的栅格项。
RasterItems; 只读。
Layer.sliced
Section titled “Layer.sliced”app.activeDocument.layers[index].sliced
如果为 true
,则图层项被切片。
默认值:false
。
布尔值。
Layer.symbolItems
Section titled “Layer.symbolItems”app.activeDocument.layers[index].symbolItems
此图层中包含的符号项。
SymbolItems; 只读。
Layer.textFrames
Section titled “Layer.textFrames”app.activeDocument.layers[index].textFrames
此图层中包含的文本艺术项。
TextFrameItems; 只读。
Layer.typename
Section titled “Layer.typename”app.activeDocument.layers[index].typename
引用对象的类名。
字符串; 只读。
Layer.visible
Section titled “Layer.visible”app.activeDocument.layers[index].visible
如果为 true
,则此图层可见。
布尔值。
Layer.zOrderPosition
Section titled “Layer.zOrderPosition”app.activeDocument.layers[index].zOrderPosition
此图层在文档图层堆叠顺序中的位置。
数字(长整型); 只读。
Layer.move()
Section titled “Layer.move()”app.activeDocument.layers[index].move(relativeObject, insertionLocation)
移动对象。
参数 | 类型 | 描述 |
---|---|---|
relativeObject | 对象 | 要移动元素的对象 |
insertionLocation | ElementPlacement, 可选 | 移动元素到的位置 |
Layer.remove()
Section titled “Layer.remove()”app.activeDocument.layers[index].remove()
删除此对象。
无。
Layer.zOrder()
Section titled “Layer.zOrder()”app.activeDocument.layers[index].zOrder(ZOrderCmd)
在包含此对象的图层或文档(parent
)的堆叠顺序中排列图层的位置。
参数 | 类型 | 描述 |
---|---|---|
zOrderCmd | ZOrderMethod | 堆叠顺序排列方法 |
无。
将图层置于最前面
Section titled “将图层置于最前面”// 将最底层的图层移动到最顶层
if (documents.length > 0) { var countOfLayers = activeDocument.layers.length; if (countOfLayers > 1) { var bottomLayer = activeDocument.layers[countOfLayers - 1]; bottomLayer.zOrder(ZOrderMethod.BRINGTOFRONT); } else { alert("活动文档只有一个图层"); }}