Skip to content

sub-objects

thisLayer

This category describes items that give you other objects based on the current layer; things like the source (for precomps or footage), effects, masks, sourceRect, etc.

On this page, we’re going to use thisLayer as a sample on how to call these items, however note that any method that returns a Layer will work.


thisLayer.source

Returns the source Comp or Footage object for the layer.

Default time is adjusted to the time in the source.

Example:

source.layer(1).position

Comp or Footage


thisLayer.effect(name)

thisLayer.effect(index)

The name value will have After Effects find the effect by its name in the Effect Controls panel. The name can be the default name or a user-defined name. If multiple effects have the same name, the effect closest to the top of the Effect Controls panel is used.

The index value will have After Effects finds the effect by its index in the Effect Controls panel, starting at 1 and counting from the top.

ParameterTypeDescription
nameStringEffect name or index to get.
indexNumber

Effect

Get the “Blurriness” effect by name:

thisLayer.effect("Fast Blur")

Get the first effect on the layer:

thisLayer.effect(1)

thisLayer.mask(name)

thisLayer.mask(index)

The name value can be the default name or a user-defined name. If multiple masks have the same name, the first (topmost) mask is used.

The index value will have After Effects finds the mask by its index in the Timeline panel, starting at 1 and counting from the top.

ParameterTypeDescription
nameStringEffect name or index to get.
indexNumber

Effect

Get the mask “Mask 1” by name:

thisLayer.mask("Mask 1")

Get the first mask on the layer:

thisLayer.mask(1)

thisLayer.sourceRectAtTime(t = time, includeExtents = false)

Returns the bounding box of the layer (or the layer’s source).

ParameterTypeDescription
tNumberOptional. The specified time (in comp seconds) to apply the smoothing filter to. Defaults to time (the current comp time, in seconds).
includeExtentsBooleanOptional. Only applies to shape layers and paragraph text layers. Defaults to false.
- For shape layers: Increases the size of the layer bounds as necessary.
- For paragraph text layers: Returns the bounds of the paragraph box

An object with four attributes: {top, left, width, height}

myTextLayer.sourceRectAtTime().width

thisLayer.sourceTime([t=time])

Returns the layer source corresponding to time t.

ParameterTypeDescription
tNumberOptional. The specified time (in comp seconds) to apply the smoothing filter to. Defaults to time (the current comp time, in seconds).

Number