Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Scripting iterative changes

  • Scripting iterative changes

  • Owen Silverwood

    January 20, 2020 at 12:16 am

    Hi everyone, I’m new to scripting and feel like I might have bitten off a big chunk for my first attempt, but necessity is the mother of invention right?

    My goal is relatively simple really:
    – duplicate the comp
    – transform the position of a layer in duplicate comp
    – send current frame to render queue
    ** duplicate the duplicated comp** and continue the process for x number of iterations.

    I have been working with ‘curVal+x’ variables to get my cumulative transforms working, but I just cant get my ‘activeItem’ to step down onto the duplicate comp OR find a way to loop the entire process for a specified number of iterations.

    I fear I might not even be using language that makes sense in the context of AE scritping, I’m really that new to it. But hopefully someone can point me in the right direction…

    Thanks! Such a great community. Long time lurker here since about 2006 I think.

  • Dan Ebberts

    January 20, 2020 at 1:15 am

    I’d probably structure it something like this:

    var numDups = 10;
    var myPosOffset = [50,50];
    var myComp = app.project.activeItem;
    var myDupComp;
    var myDupLayer;
    var myPos;
    for (var i = 1; i <= numDups; i++){
    myDupComp = myComp.duplicate();
    myDupLayer = myDupComp.layer(1);
    myPos ="Position").value;"Position").setValue([myPos[0]+myPosOffset[0],myPos[1]+myPosOffset[1]]);
    // do render stuff
    myComp = myDupComp;


  • Owen Silverwood

    January 20, 2020 at 11:23 am

    Dan, thank you so much. I hadn’t anticipated someone literally translating what I’d said and posting it for me. Thats very kind of you.

    It works exactly as I hoped, and I can pretty much wrap my head around why, which is just as important.

    As soon as I can get the additional render commands working, I’ll be on my way.

    Thanks again. Hopefully useful for someone else at some point too.

    PS: For the record, in case it’s useful in the future: This was specifically required for the rendering of moving slitscan images, where the relationship between time and position is somewhat changed, meaning that regular keyframes and expressions couldn’t achieve the intended result.

Viewing 1 - 3 of 3 posts

Log in to reply.

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