AVLayer object
app.project.item(index).layer(index)
The AVLayer object provides an interface to those layers that contain AVItem objects (composition layers, footage layers, solid layers, text layers, and sound layers).
- AVLayer is a subclass of Layer. All methods and attributes of Layer, in addition to those listed below, are available when working with AVLayer. See “Layer object” on page 86.
- AVLayer is a base class for TextLayer, so AVLayer attributes and methods are available when working with TextLayer objects. See “TextLayer object” on page 188.
AE Properties
Different types of layers have different AE properties. AVLayer has the following properties and property groups:
- Marker
- Time Remap
- Motion Trackers
- Masks
- Effects
- Transform
- Anchor Point
- Position
- Scale
- Orientation
- X Rotation
- Y Rotation
- Rotation
- Opacity
- Layer Styles
- Geometry Options Ray-traced 3D
- Material Options
- Casts Shadows
- Light Transmission
- Accepts Shadows
- Accepts Lights
- Appears in Reflections Ray-traced 3D
- Ambient
- Diffuse
- Specular Intensity
- Specular Shininess
- Metal
- Reflection Intensity Ray-traced 3D
- Reflection Sharpness Ray-traced 3D
- Reflection Rolloff Ray-traced 3D
- Transparency Ray-traced 3D
- Transparency Rolloff Ray-traced 3D
- Index of Refraction Ray-traced 3D
- Audio
- Audio Levels
Example
If the first item in the project is a CompItem, and the first layer of that CompItem is an AVLayer, the following sets the layer quality, startTime, and inPoint.
var firstLayer = app.project.item(1).layer(1);
firstLayer.quality = LayerQuality.BEST;
firstLayer.startTime = 1;
firstLayer.inPoint = 2;
Attribute List
| Attribute | Description |
|---|---|
| source | The source item for this layer. |
| isNameFromSource | When true, the layer has no expressly set name, but contains a named source. |
| height | The height of the layer. |
| width | The width of the layer. |
| audioEnabled | When true, the layer's audio is enabled. |
| motionBlur | When true, the layer's motion blur is enabled. |
| effectsActive | When true, the layer's effects are active. |
| adjustmentLayer | When true, this is an adjustment layer. |
| guideLayer | When true, this is a guide layer. |
| threeDLayer | When true, this is a 3D layer. |
| threeDPerChar | When true, 3D is set on a per-character basis in this text layer. |
| environmentLayer | When true, this is an environment layer. |
| canSetCollapseTransformation | When true, it is legal to change the value of collapseTransformation. |
| collapseTransformation | When true, collapse transformation is on. |
| frameBlending | When true, frame blending is enabled. |
| frameBlendingType | The type of frame blending for the layer. |
| canSetTimeRemapEnabled | When true, it is legal to change the value of timeRemapEnabled. |
| timeRemapEnabled | When true, time remapping is enabled on this layer. |
| hasAudio | When true, the layer contains an audio component. |
| audioActive | When true, the layer's audio is active at the current time. |
| blendingMode | The blending mode of the layer. |
| preserveTransparency | When true, preserve transparency is enabled. |
| trackMatteType | if layer has a track matte, specifies the way it is applied. |
| isTrackMatte | When true, this layer is being used as a track matte for the layer below it. |
| hasTrackMatte | When true, the layer above is being used as a track matte on this layer. |
| quality | The layer quality setting. |
| autoOrient | The type of automatic orientation for the layer. |
Method List
| Method | Description |
|---|---|
| audioActiveAtTime() | Reports whether this layer's audio is active at a given time. |
| calculateTransformFromPoints() | Calculates a transformation from a set of points in this layer. |
| replaceSource() | Changes the source item for this layer. |
| sourceRectAtTime() | Retrieves the source rectangle of a layer. |
| openInViewer() | Opens the layer in a Layer panel. |
adjustmentLayer attribute
app.project.item(index).layer(index).adjustmentLayer
True if the layer is an adjustment layer.
Type: Boolean read/write.
audioActive attribute
app.project.item(index).layer(index).audioActive
True if the layer's audio is active at the current time.
For this value to be true, audioEnabled must be tr ue, no other layer with audio may be soloing unless this layer is soloed too, and the time must be between the inPoint and outPoint of this layer.
Type: Boolean read-only
audioActiveAtTime() method
app.project.item(index).layer(index).audioActiveAtTime(time)
Returns true if this layer's audio will be active at the specified time. For this method to return true, audioEnabled must be true, no other layer with audio may be soloing unless this layer is soloed too, and the time must be between the inPoint and outPoint of this layer.
Parameters:
- time The time, in seconds. A floating-point value.
Returns: Boolean
audioEnabled attribute
app.project.item(index).layer(index).audioEnabled
When true, the layer's audio is enabled. This value corresponds to the audio toggle switch in the Timeline panel.
Type: Boolean read/write
autoOrient attribute
app.project.item(index).layer(index).autoOrient
The type of automatic orientation to perform for the layer.
Type: An AutoOrientType enumerated value; read/write. One of:
- AutoOrientType.ALONG_PATH Layer faces in the direction of the motion path.
- AutoOrientType.CAMERA_OR_POINT_OF_INTEREST Layer always faces the active camera or points at its point of interest.
- AutoOrientType.CHARACTERS_TOWARD_CAMERA Each character in a per-character 3D text layer automatically faces the active camera.
- AutoOrientType.NO_AUTO_ORIENT Layer rotates freely, independent of any motion path, point of interest, or other layers.
blendingMode attribute
app.project.item(index).layer(index).blendingMode
The blending mode of the layer.
Type: A BlendingMode enumerated value; read/write. One of:
- BlendingMode.ADD
- BlendingMode.ALPHA_ADD
- BlendingMode.CLASSIC_COLOR_BURN
- BlendingMode.CLASSIC_COLOR_DODGE
- BlendingMode.CLASSIC_DIFFERENCE
- BlendingMode.COLOR
- BlendingMode.COLOR_BURN
- BlendingMode.COLOR_DODGE
- BlendingMode.DANCING_DISSOLVE
- BlendingMode.DARKEN
- BlendingMode.DARKER_COLOR
- BlendingMode.DIFFERENCE
- BlendingMode.DISSOLVE
- BlendingMode.EXCLUSION
- BlendingMode.HARD_LIGHT
- BlendingMode.HARD_MIX
- BlendingMode.HUE
- BlendingMode.LIGHTEN
- BlendingMode.LIGHTER_COLOR
- BlendingMode.LINEAR_BURN
- BlendingMode.LINEAR_DODGE
- BlendingMode.LINEAR_LIGHT
- BlendingMode.LUMINESCENT_PREMUL
- BlendingMode.LUMINOSITY
- BlendingMode.MULTIPLY
- BlendingMode.NORMAL
- BlendingMode.OVERLAY
- BlendingMode.PIN_LIGHT
- BlendingMode.SATURATION
- BlendingMode.SCREEN
- BlendingMode.SILHOUETE_ALPHA
- BlendingMode.SILHOUETTE_LUMA
- BlendingMode.SOFT_LIGHT
- BlendingMode.STENCIL_ALPHA
- BlendingMode.STENCIL_LUMA
- BlendingMode.VIVID_LIGHT
calculateTransformFromPoints() method
app.project.item(index).layer(index).calculateTransformFromPoints(
pointTopLeft,
pointTopRight,
pointBottomRight
)
Calculates a transformation from a set of points in this layer.
Parameters:
- pointTopLeft The top left point coordinates in the form of an array, [x, y, z].
- pointTopRight The top right point coordinates in the form of an array, [x, y, z].
- pointBottomRight The bottom right point coordinates in the form of an array, [x, y, z].
Returns: An Object with the transformation properties set.
Example:
var newLayer = comp.layers.add(newFootage);
newLayer.threeDLayer = true;
newLayer.blendingMode = BlendingMode.ALPHA_ADD;
var transform = newLayer.calculateTransformFromPoints(tl, tr, bl);
for(var sel in transform) {
newLayer.transform[sel].setValue(transform[sel]);
}
canSetCollapseTransformation attribute
app.project.item(index).layer(index).canSetCollapseTransformation
True if it is legal to change the value of the collapseTransformation attribute on this layer.
Type: Boolean read-only
canSetTimeRemapEnabled attribute
app.project.item(index).layer(index).canSetTimeRemapEnabled
True if it is legal to change the value of the timeRemapEnabled attribute on this layer.
Type: Boolean read-only
collapseTransformation attribute
app.project.item(index).layer(index).collapseTransformation
True if collapse transformation is on for this layer.
Type: Boolean read/write.
effectsActive attribute
app.project.item(index).layer(index).effectsActive
True if the layer's effects are active, as indicated by the [f] icon next to it in the user interface.
Type: Boolean read/write.
environmentLayer attribute
app.project.item(index).layer(index).environmentLayer
True if this is an environment layer in a Ray-traced 3D composition. Setting this attribute to true automatically makes the layer 3D (threeDLayer becomes true).
Type: Boolean read/write.
frameBlending attribute
app.project.item(index).layer(index).frameBlending
True if frame blending is enabled for the layer.
Type: Boolean read-only
frameBlendingType attribute
app.project.item(index).layer(index).frameBlendingType
The type of frame blending to perform when frame blending is enabled for the layer.
Type: A FrameBlendingType enumerated value; read/write. One of:
- FrameBlendingType.FRAME_MIX
- FrameBlendingType.NO_FRAME_BLEND
- FrameBlendingType.PIXEL_MOTION
guideLayer attribute
app.project.item(index).layer(index).guideLayer
True if the layer is a guide layer.
Type: Boolean read/write
hasAudio attribute
app.project.item(index).layer(index).hasAudio
True if the layer contains an audio component, regardless of whether it is audio-enabled or soloed.
Type: Boolean read-only
AV Layer hasTrack M atte attribute
app.project.item(index).layer(index).hasTrackMatte
True if the layer in front of this layer is being used as a track matte on this layer. When true, this layer's track- MatteType value controls how the matte is applied.
Type: Boolean read-only
AV Layer height attribu te
app.project.item(index).layer(index).height
The height of the layer in pixels.
Type: Floating-point; read-only
isNameFromSource attribute
app.project.item(index).layer(index).isNameFromSource
True if the layer has no expressly set name, but contains a named source. In this case, layer.name has the same value as layer.source.name. False if the layer has an expressly set name, or if the layer does not have a source.
Type: Boolean read-only
isTrackMatte attribute
app.project.item(index)layer(index).isTrackMatte
True if this layer is being used as a track matte for the layer behind it.
Type: Boolean read-only
motionBlur attribute
app.project.item(index).layer(index).motionBlur
True if motion blur is enabled for the layer.
Type: Boolean read/write.
openInViewer() method
app.project.item(index).layer(index).openInViewer()
Opens the layer in a Layer panel, and moves the Layer panel to front and gives it focus.
Parameters: None.
Returns: Viewer object for the Layer panel, or null if the layer could not be opened (e.g., for text or shape layers, which cannot be opened in the Layer panel).
preserveTransparency attribute
app.project.item(index).layer(index).preserveTransparency
True if preserve transparency is enabled for the layer.
Type: Boolean read/write.
quality attribute
app.project.item(index).layer(index).quality
The quality with which this layer is displayed.
Type: A LayerQuality enumerated value; read/write. One of:
- LayerQuality.BEST
- LayerQuality.DRAFT
- LayerQuality.WIREFRAME
replaceSource() method
app.project.item(index).layer(index).replaceSource (newSource, fixExpressions)
Replaces the source for this layer.
Parameters:
- newSource The new source AVItem object.
- fixExpressions Tr u e to adjust expressions for the new source, false otherwise. Note that this feature can be resource-intensive; if replacing a large amount of footage, do this only at the end of the operation. See also “Project autoFixExpressions() method” on page 115.
Returns: Nothing.
source attribute
app.project.item(index).layer(index).source
The source AVItem for this layer. The value is null in a Text layer. Use AVLayer.replaceSource() to change the value.
Type: AVItem object read-only
sourceRectAtTime() method
app.project.item(index).layer(index).sourceRectAtTime(timeT, extents)
Retrieves the rectangle bounds of the layer at the specified time index, corrected for text or shape layer content. Use, for example, to write text that is properly aligned to the baseline.
Parameters:
- timeT The time index, in seconds. A floating-point value.
- extents True to include the extents, false otherwise. Extents apply to shape layers, increasing the size of the layer bounds as necessary.
Returns: A JavaScript object with four attributes [top, left, width, height].
threeDLayer attribute
app.project.item(index).layer(index).threeDLayer
True if this is a 3D layer.
Type: Boolean read/write
threeDPerChar attribute
app.project.item(index).layer(index).threeDPerChar
True if this layer has the Enable Per-character 3D switch set, allowing its characters to be animated off the plane of the text layer. Applies only to text layers.
Type: Boolean read/write.
timeRemapEnabled attribute
app.project.item(index).layer(index).timeRemapEnabled
True if time remapping is enabled for this layer.
Type: Boolean read/write
trackMatteType attribute
app.project.item(index).layer(index).trackMatteType
If this layer has a track matte, specifies the way the track matte is applied.
Type: A TrackMatteType enumerated value; read/write. One of:
- TrackMatteType.ALPHA
- TrackMatteType.ALPHA_INVERTED
- TrackMatteType.LUMA
- TrackMatteType.LUMA_INVERTED
- TrackMatteType.NO_TRACK_MATTE
width attribute
app.project.item(index).layer(index).width
The width of the layer in pixels.
Type: Floating-point read-only