Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Scripting: Add loopOut() Expression to a selectedLayer with a script?

  • Scripting: Add loopOut() Expression to a selectedLayer with a script?

    Posted by Brandon Smith on February 6, 2013 at 2:18 am

    I am beginning to learn scripting, so I am starting off with some simple shortcut scripts. One that I am having a hard time trying to make is a script that will apply the loopOut() expression to the Position property of the layer that I have selected (or multiple selected layers). This layer already has the necessary keyframes to let the loopOut() expression work.

    Any help is greatly appreciated.

    Thanks,
    Brandon

    Brandon Smith replied 13 years, 7 months ago 3 Members · 3 Replies
  • 3 Replies
  • Vishesh Arora

    February 6, 2013 at 9:55 am

    Brandon

    You will get a better answer at Adobe After Effects Expressions.

    Vishesh Arora
    3D and Motion Graphics Artist
    Films Rajendra

    Blog:
    https://digieffects.wordpress.com

    2011 3D Demo Reel:
    https://www.youtube.com/watch?v=lHPgIJU_BR8

  • Xavier Gomez

    February 6, 2013 at 1:36 pm

    Assuming that :
    1- your script has already identified the layer (let’s call it theLayer),
    2- your script has a string variable (called say expr) that contains the expression text,
    you can go on like this:

    var prop = theLayer.transform.position;
    prop.expression = expr;
    prop.expressionEnabled = true;

    if you want need your script to read the property’s values at a given time t, it is like this:

    – for pre-expression value: prop.valueAtTime(t, true)
    – for post-expression value : prop.valueAtTime(t, false)

  • Brandon Smith

    February 6, 2013 at 5:42 pm

    Thanks for the response Xavier

    Here is my code that I am currently working with, but it keeps crapping out when it gets to the actual expression. Any ideas?


    var myComp = app.project.activeItem;
    var myLayer = myComp.selectedLayers[0];
    var prop = myLayer.transform.position;
    prop.expression = "loopOut("cycle")";
    prop.expressionEnabled = true;

    Thanks!

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