beautypg.com

Layer properties attributes and methods – Adobe After Effects CS3 User Manual

Page 576

background image

AFTER EFFECTS CS3

User Guide

571

Returns true if the layer’s Video switch

is on and the current time is between the layer’s In point and Out point;

false otherwise.

audioActive

Return type: Boolean.

Returns true if the layer’s Audio switch

is on and the current time is between the layer’s In point and Out point;

false otherwise.

sampleImage(point, radius = [.5, .5], postEffect=true, t=time)

Return type: Array [4].

Argument type: point is an Array [2], radius is an Array [2], postEffect is a Boolean, and t is a Number.

Samples the color and alpha channel values of a layer and returns the average alpha-weighted value of the pixels
within the specified distance of the point as an array: [red, green, blue, alpha]. If postEffect is true, the sampled values
are for the layer after masks and effects on that layer have been rendered; if postEffect is false, the sampled values are
for the layer before masks and effects have been rendered. The input value point is in layer space; the point [0,0] is
the center of the top-left pixel in the layer. The input value radius specifies the horizontal and vertical distance from
the sample center to the edges of the sampled rectangle. The default value samples one pixel.

Note: The

postEffect

parameter refers to effects applied directly to the layer, not to effects applied indirectly, such as

with an adjustment layer.

This example samples a rectangle 4 pixels wide and 3 pixels high, centered around a point 100 pixels down and to
the right of the upper-left corner of the layer:

thisComp.layer(1).sampleImage([100, 100], [2, 1.5])

Dan Ebberts has an example of how to use the

sampleImage

method on his website:

www.adobe.com/go/learn_ae_danobscuration

.

Layer Properties attributes and methods

When you add masks, effects, paint, or text to a layer, After Effects adds new properties to the Timeline panel. There
are too many of these properties to list here, so use the pick whip to learn the syntax for referring to them in your
expressions.

anchorPoint

Return type: Property [2 or 3].

Returns the anchor point value of the layer in the layer’s space.

position

Return type: Property [2 or 3].

Returns the position value of the layer, in world space if the layer has no parent or in the parent’s layer space if there
is a parent.

scale

Return type: Property [2 or 3].

Returns the scale value of the layer, expressed as a percentage.

rotation

Return type: Property.

Returns the rotation value of the layer in degrees. For a 3D layer, it returns the z rotation value in degrees.

opacity

Return type: Property.

Returns the opacity value for the layer, expressed as a percentage.

audioLevels

Return type: Property [2].