AVLayer
Properties
true if the layer's audio is active at the current time. For this value to be 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.true, the layer's audio is enabled. This value corresponds to the audio toggle switch in the Timeline panel.true if it is legal to change the value of the collapseTransformation attribute on this layer.true if it is legal to change the value of the timeRemapEnabled attribute on this layer.true if collapse transformation is on for this layer.true if the layer's effects are active, as indicated by the <f> icon next to it in the user interface.true if frame blending is enabled for the layer.true if the layer is a guide layer.true if the layer contains an audio component, regardless of whether it is audio-enabled or soloed.true if this layer has track matte. When true, this layer's trackMatteType value controls how the matte is applied. See AVLayer.trackMatteType for available track matte types.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.true if this layer is being used as a track matte.true if motion blur is enabled for the layer.true if preserve transparency is enabled for the layer.null in a Text layer. Use AVLayer.replaceSource() to change the value.true if this is a 3D layer.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.true if time remapping is enabled for this layer.null if this layer has no track matte layer.TrackMatteType.NO_TRACK_MATTE type will remove the track matte for this layer and reset the track matte type.Instance Methods
activeAtTime
Returns: boolean
Since: 27.0
Returns true if this layer will be active at the specified time. To return true, the layer must be enabled, no other layer may be soloing unless this layer is soloed too, and the time must be between the inPoint and outPoint values of this layer.
Parameters
addGuide
Returns: any
Since: 27.0
Adds a guide to the layer's view and returns its index. There are two forms: addGuide(orientationType, position) - adds a pixel guide using an orientation and a pixel position. addGuide(guideOptions) - adds a guide described by a GuideOptions object, allowing percentage positioning, per-guide color, and pinning (After Effects 26.5 and later; calling this form in an earlier version raises an error).
Parameters
addProperty
Returns: PropertyGroup
Since: 27.0
Creates and returns a PropertyBase object with the specified name, and adds it to this group. In general, you can only add properties to an indexed group (a property group that has the type PropertyType.INDEXED_GROUP). The only exception is a text animator property, which can be added to a named group (type PropertyType.NAMED_GROUP). If this method cannot create a property with the specified name, it generates an exception. To check that you can add a particular property to this group, call canAddProperty before calling this method. Warning: when you add a new property to an indexed group, the indexed group gets recreated from scratch, invalidating all existing references to properties. One workaround is to store the index of the added property with property.propertyIndex.
Parameters
addToMotionGraphicsTemplate
Returns: boolean
Since: 27.0
Adds the layer to the Essential Graphics Panel for the specified composition. Returns true if the layer is successfully added. In this binding, if the layer cannot be added because it is not a Media Replacement layer or because it is already added to the EGP for that composition, the call emits a warning and returns undefined instead of false. Use canAddToMotionGraphicsTemplate() to test whether the layer can be added first.
Parameters
addToMotionGraphicsTemplateAs
Returns: boolean
Since: 27.0
Adds the layer to the Essential Graphics Panel for the specified composition. Returns true if the layer is successfully added, or otherwise false. If the layer cannot be added, it is either because it is not a layer type for which media can be replaced (referred to as Media Replacement Layers), or the layer has already been added to the EGP for that composition. After Effects will present a warning dialog if the layer cannot be added to the EGP. Use canAddToMotionGraphicsTemplate() to test whether the layer can be added to a Motion Graphics template.
Parameters
addVariableFontAxis
Returns: Property
Since: 27.0
Creates and returns a Property object for a variable font axis, and adds it to this property group. This method can only be called on the "ADBE Text Animator Properties" property group within a text animator. Common axis tags include (but are not limited to): "wght" - Weight (100-900 typical range), "wdth" - Width (percentage of normal width), "slnt" - Slant (angle in degrees), "ital" - Italic (0-1 range), "opsz" - Optical Size (point size). Fonts may also include custom axes with 4-character uppercase tags (e.g., "INFM" for Informality).
Parameters
applyPreset
Returns: boolean
Since: 27.0
Applies the specified collection of animation settings (an animation preset) to all the currently selected layers of the comp to which the layer belongs. If no layer is selected, it applies the animation preset to a new solid layer. Predefined animation preset files are installed in the Presets folder, and users can create new animation presets through the user interface. The animation preset is applied to the selected layer(s) of the comp, not to the layer whose applyPreset function is called; the layer whose applyPreset is called just determines the comp whose layers are processed.
Parameters
audioActiveAtTime
Returns: boolean
Since: 27.0
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
calculateTransformFromPoints
Returns: { anchorPoint: number[]; position: number[]; xRotation: number; yRotation: number; zRotation: number; scale: number[] }
Since: 27.0
Calculates a transformation from a set of points in this layer.
Parameters
canAddProperty
Returns: boolean
Since: 27.0
Returns true if a property with the given name can be added to this property group. For example, you can only add mask to a mask group. The only legal input arguments are "mask" or "ADBE Mask Atom".
Parameters
canAddToMotionGraphicsTemplate
Returns: boolean
Since: 27.0
Test whether or not the layer can be added to the Essential Graphics Panel for the specified composition. Returns true if the layer can be added, or otherwise false. Media Replacement layers are recognized as AVLayers with a source set to a FootageItem (with specific source types) or a CompItem. The AVLayer must comply with restrictions: Layer.hasVideo must be true, AVLayer.adjustmentLayer must be false, Layer.nullLayer must be false, and if the source is a FootageItem its FootageSource must not be a SolidSource, and if that FootageSource is a FileSource it must not point to a non-media file (e.g. a JSX script file).
Parameters
compPointToSource
Returns: number[]
Since: 27.0
Converts composition coordinates, such as sourcePointToComp, to layer coordinates. This value only reflects the first character in the text layer at the current time.
Parameters
copyToComp
Returns: boolean
Since: 27.0
Copies the layer into the specified composition. The original layer remains unchanged. Creates a new Layer object with the same values as this one, and prepends the new object to the LayerCollection in the target CompItem. Copying in a layer changes the index positions of previously existing layers in the target composition. This is the same as copying and pasting a layer through the user interface.
Parameters
doSceneEditDetection
Returns: number[]
Since: 27.0
Runs Scene Edit Detection on the layer that the method is called on and returns an array containing the times of any detected scenes. This is the same as selecting a layer in the Timeline and choosing "Layer > Scene Edit Detection", with the single argument determining whether the edits are applied as markers, layer splits, pre-comps, or are not applied to the layer. doSceneEditDetection will fail and error if called on a non-video layer or a video layer with Time Remapping enabled.
Parameters
duplicate
Returns: AVLayer
Since: 27.0
Duplicates the layer. Creates a new Layer object in which all values are the same as in this one. This has the same effect as selecting a layer in the user interface and choosing Edit > Duplicate, except the selection in the user interface does not change when you call this method.
getGuideAsObject
Returns: GuideOptions
Since: 27.0
Returns the guide at the specified index as a GuideOptions object, which you can modify and pass back to setGuide(). This is a convenient way to read a guide's full state (orientation, position, position type, color, pinning).
Parameters
getRenderGUID
Returns: DeferredCall
Since: 27.0
Starts an asynchronous render of the layer at the given time on the specified thread and returns a DeferredCall. Calling .wait() on the result yields a render GUID string once the render completes; pass true for trace to enable additional tracing.
Parameters
moveAfter
Returns: boolean
Since: 27.0
Moves this layer to a position immediately after (below) the specified layer.
Parameters
moveBefore
Returns: boolean
Since: 27.0
Moves this layer to a position immediately before (above) the specified layer.
Parameters
moveTo
Returns: boolean
Since: 27.0
Moves this property to a new position in its parent property group. Works as documented for children of indexed groups (effects, masks, motion trackers).
Parameters
moveToBeginning
Returns: boolean
Since: 27.0
Moves this layer to the topmost position of the layer stack (the first layer).
moveToEnd
Returns: boolean
Since: 27.0
Moves this layer to the bottom position of the layer stack (the last layer).
openInViewer
Returns: Viewer
Since: 27.0
Opens the layer in a Layer panel, and moves the Layer panel to front and gives it focus.
property
Returns: any
Since: 27.0
Finds and returns a child property of this group, as specified by either its index or name. A name specification can use the same syntax that is available with expressions. mylayer.position, mylayer("position"), mylayer.property("position"), mylayer(1), and mylayer.property(1) are all equivalent. Some properties of a layer, such as position and zoom, can be accessed only by name. When using the name to find a property that is multiple levels down, you must make more than one call to this method - for example, myLayer.property("ADBE Masks").property(1) searches two levels down.
Parameters
propertyGroup
Returns: PropertyGroup
Since: 27.0
Gets the PropertyGroup object for an ancestor group of this property at a specified level of the parent-child hierarchy.
Parameters
remove
Returns: boolean
Since: 27.0
Deletes the specified layer from the composition.
removeGuide
Returns: boolean
Since: 27.0
Removes an existing guide. Choose the guide based on its index inside the Layer.guides array.
Parameters
removeTrackMatte
Returns: boolean
Since: 27.0
Removes the track matte for this layer while preserving the TrackMatteType. See AVLayer.setTrackMatte() for another way of removing track matte.
replaceSource
Returns: boolean
Since: 27.0
Replaces the source for this layer.
Parameters
true to adjust expressions for the new source, otherwise false.savePreset
Returns: boolean
Since: 27.0
Saves the currently selected properties of this layer as an animation preset (.ffx) file at the given path. Returns true if the preset was written successfully, or false if nothing was selected to save (for example, if the layer itself is not selected).
Parameters
setGuide
Returns: any
Since: 27.0
Updates an existing guide. Two forms, distinguished by the type of the second argument: setGuide(position, guideIndex) moves the guide at guideIndex to a new pixel position (position first, index second); a guide's orientationType may not be changed after creation. setGuide(guideIndex, guideOptions) applies the properties set on a GuideOptions object to the guide at guideIndex as a partial update (After Effects 26.5 and later).
Parameters
setParentWithJump
Returns: boolean
Since: 27.0
Sets the parent of this layer to the specified layer, without changing the transform values of the child layer. There may be an apparent jump in the rotation, translation, or scale of the child layer, as this layer's transform values are combined with those of its ancestors. If you do not want the child layer to jump, set the parent attribute directly instead.
Parameters
setTrackMatte
Returns: boolean
Since: 27.0
Sets the track matte layer and type for this layer. Passing in null to trackMatteLayer parameter removes the track matte. See AVLayer.removeTrackMatte() for another way of removing track matte.
Parameters
sourcePointToComp
Returns: number[]
Since: 27.0
Converts layer coordinates, such as boxTextPos, to composition coordinates. This value only reflects the first character in the text layer at the current time.
Parameters
sourceRectAtTime
Returns: { height: number; left: number; top: number; width: number }
Since: 27.0
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
true to include the extents, otherwise false. Extents apply to shape layers, increasing the size of the layer bounds as necessary.