Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions scripting question: link expression in script

  • scripting question: link expression in script

    Posted by Danni Runitz on August 28, 2015 at 2:02 pm

    Hey!

    I’m new to scripting and can’t get my first code done.

    Within my script I’ve been able to create 4 slider to the text layer, but can’t get my expression into the “soure text”.

    this is the expression I want to write in there:

    startT = effect(“StartFrame”)(“Slider”);
    endT = effect(“EndFrame”)(“Slider”);
    beginVal = effect(“BeginVal”)(“Slider”);
    endVal = effect(“EndVal”)(“Slider”);
    t = linear(time,startT,endT,beginVal,endVal);
    t.toFixed(0)

    How do I tell program to write that in the “source text” expression

    help pls?

    Danni Runitz replied 10 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    August 28, 2015 at 7:24 pm

    That would look something like this:


    var myTextLayer = app.project.activeItem.layer(1);
    var myExpr = 'startT = effect("StartFrame")("Slider");\r' +
    'endT = effect("EndFrame")("Slider");\r' +
    'beginVal = effect("BeginVal")("Slider");\r' +
    'endVal = effect("EndVal")("Slider");\r' +
    't = linear(time,startT,endT,beginVal,endVal);\r' +
    't.toFixed(0)';

    myTextLayer.property("Text").property("Source Text").expression = myExpr;

    Dan

  • Danni Runitz

    August 28, 2015 at 8:28 pm

    Dan you are seriously the best! Worked perfectly!

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