Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Reference to expression text instead of final result

  • Reference to expression text instead of final result

    Posted by Gabriele Bartoli on March 12, 2013 at 4:14 pm

    Hello,

    I’m pretty sure this can’t be done, but I’ll try and see if any of you guys might prove me wrong.

    Let’s say I have an expression like the following, which moves the layer given its in and out points:

    transitionLength = effect("Transition Length")("Slider");

    xPos = ease(time,outPoint - transitionLength,outPoint, 960, 960 - 1920);

    [xPos, value[1]]

    If I wanted to apply it to a bunch of layers to be sequenced, I would have to copy and paste it, while fixing the link to the effect slider on top.

    I was wondering if there might be a way to tell the position value of those layers to read the content of the expression text, instead of the output value, so that I would simply have to link them to the first layer and then worrying about changes only for the original expression.

    Does it make any sense?

    Cheers and thanks!

    G.

    Gabriele Bartoli replied 13 years, 4 months ago 3 Members · 9 Replies
  • 9 Replies
  • Mitch Mann

    March 12, 2013 at 4:24 pm

    I don’t think you can “Eval()” in expressions, unfortunately, so I’m not sure of a way to have one expression evaluate a line of code from a text layer, for example.

    Maybe just put your expression on a slider on a null layer, then have all the layers read the output of that slider.

  • Gabriele Bartoli

    March 12, 2013 at 4:53 pm

    I was thinking about the text layer option too.

    Anyway, it’s not such a big deal, it was more about satisfying my curiosity.

    Thanks a bunch for the reply though.

  • Dan Ebberts

    March 12, 2013 at 6:33 pm

    The text layer thing actually will work:

    txt = thisComp.layer(“Text”).text.sourceText.value;
    eval(txt)

    Dan

  • Gabriele Bartoli

    March 12, 2013 at 6:39 pm

    Thanks, I’ll give it a go then!

    Cheers

  • Gabriele Bartoli

    March 15, 2013 at 4:48 pm

    Funny enough, I got stuck in the easy part: I can’t figure out how to paste the expression in the Source Text expression field as simple Text. If I put “” at the extremes of the whole expression, it doesn’t work. I’m afraid I’m doing something wrong syntax-wise.

    😛

  • Gabriele Bartoli

    March 15, 2013 at 4:56 pm

    Never mind, I found another post where you suggested to use triple quotations, and that worked out fine. But since we’re here, can I ask you where I can find a little more info regarding the eval() function?

    Cheers and thanks a lot

  • Dan Ebberts

    March 15, 2013 at 5:00 pm

    You can enclose the entire expression in triple quotes:

    “””
    (your expression)
    “””

    Or, you could just paste the expression into the text layer as text (not as a Source Text expression).

    Dan

  • Dan Ebberts

    March 15, 2013 at 5:02 pm

    Any good JavaScript reference should cover it. Here’s the entry from w3schools:

    https://www.w3schools.com/jsref/jsref_eval.asp

    Dan

  • Gabriele Bartoli

    March 15, 2013 at 5:09 pm

    Ok, thanks!

    So, what it does is simply reading a string and then treat it as an expression, nothing more. Good to know. Kudos!

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