Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Help with Applying Expressions to Different Type of Layers

  • Help with Applying Expressions to Different Type of Layers

    Posted by Vincenzo Imbimbo on February 21, 2025 at 2:25 pm

    Hello everyone,

    I’m working on a script for After Effects where I apply expressions to properties of the Transform effect (not the layer’s direct transform properties).

    I’m trying to apply expressions to properties of the Transform effect (transformAnchorPoint and transformPosition), but it seems the expressions are not being applied. The effect is applied to the layers, but no expression is assigned to these properties.

    try { var transformAnchorPoint = transformEffect.property("ADBE Geometry2-0001");

    var transformPosition = transformEffect.property("ADBE Geometry2-0002");

    // Check if the layer is a Shape Layer or Text Layer

    if (thisLayer instanceof ShapeLayer || thisLayer instanceof TextLayer) {

    transformAnchorPoint.expression = "my expression;";

    // Condition for button 5

    if (direction === "5") {

    transformPosition.expression = "my expression;";

    } else {

    transformPosition.expression = "my expression;";

    }

    } else {

    // For solid or image layers (JPG, PNG, AI, PSD, etc.)

    transformAnchorPoint.expression = "my expression;";

    // Condition for button 5

    if (direction === "5") {

    transformPosition.expression = "my expression;";

    } else {

    transformPosition.expression = "my expression;";

    }

    }

    } catch (e) {

    continue; // If an error occurs while adding expressions, continue to the next layer

    }

    Vincenzo Imbimbo replied 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 21, 2025 at 5:31 pm

    I’m not sure what the issue is–I just ran a little test, and this worked for me:

    var transformEffect = app.project.activeItem.layer(1).property("ADBE Effect Parade").property("ADBE Geometry2");
    transformEffect.property("ADBE Geometry2-0002").expression = "value";
  • Vincenzo Imbimbo

    February 21, 2025 at 6:07 pm

    Thanks Dan, i found the solution by doing it this way:

    try {

    var transformAnchorPoint = transformEffect.property("ADBE Geometry2-0001");

    var transformPosition = transformEffect.property("ADBE Geometry2-0002");

    // Detect type of layer

    var isShapeLayer = layer.matchName === "ADBE Vector Layer";

    var isTextLayer = layer.matchName === "ADBE Text Layer";

    if (isShapeLayer || isTextLayer) {

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy