Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Trouble scripting Injecting expression on “Rotate”

  • Trouble scripting Injecting expression on “Rotate”

    Posted by Raphael Luz on September 2, 2022 at 9:25 pm

    Hello friends,
    i’m trying to simply my workflow…so i tried to create a script to inject a expression on Rotation property of selected layers (not just only one)

    Unfortunately i’m very bad at this, and i frequently get lost in expressions reference guides 🤣

    Can please some good soul help me?

    The best i could do:

    (function () {

    if(app.project.activeItem == null || !(app.project.activeItem instanceof CompItem)) {

    alert(“please select a valid item”);

    return false;

    }

    var myComposition = app.project.activeItem;

    var myLayer = myComposition.layer[0];

    myLayer.property(“ADBE Transform Group”).property(“ADBE Rotate”).expression = ‘value – parent.transform.rotation’;

    })();

     

    My plan is to use this script at KBar

    Thanks in advance

    Raphael Luz replied 4 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 3, 2022 at 12:32 am

    Like this, I think:

    (function () {
    if(app.project.activeItem == null || !(app.project.activeItem instanceof CompItem)) {
    alert("please select a valid item");
    return false;
    }
    var myComposition = app.project.activeItem;
    var myLayers = myComposition.selectedLayers;
    for (var i = 0; i < myLayers.length; i++){
    myLayers[i].property("ADBE Transform Group").property("ADBE Rotate Z").expression = 'value - parent.transform.rotation';
    }
    })();
  • Raphael Luz

    September 5, 2022 at 3:14 pm

    Amazing! Worked fine…thank you very much!

    Expression legend 🤩

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