Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Load external expression.txt and reference a slider in the comp

  • Load external expression.txt and reference a slider in the comp

  • Christiaan Vee

    November 24, 2022 at 9:45 am

    Hi

    I’ve set up an external .txt file which is referenced by multiple layers with $.evalFile(). The load works fine, but I have an issue with expression sliders that I’ve referenced. An extract…

    rate = thisComp.layer(“settings”).effect(“rate”)(“Slider”);

    posterizeTime(rate);


    returns the following

    Error: Reference Error: seedRandom is not defined.


    Is there a way for me to use expression sliders in an expression that is loaded from an external file? The reason I’m doing this in the first place is that I’d like this to run across many layers and updating each when I make a change becomes really tedious. If the above is not possible, do you have a workflow that works for you?

    Thanks


  • Christiaan Vee

    November 24, 2022 at 10:01 am

    A work around I’m using is to copy the script into a text layer and to reference that in the other layer. I’d still be interested to hear if I can do it externally.

    eval(thisComp.layer(“colour A”).text.sourceText.value);

  • Filip Vandueren

    November 24, 2022 at 11:13 am

    Hi Christiaan,

    Javascript in external files get processed a bit different, and need more methods to be tied explicitly to their ancestor (usually thisProperty and thisLayer)

    In this case you would need:

    thisLayer.seedRandom()

    read more about it here:

    https://helpx.adobe.com/au/after-effects/using/legacy-and-extend-script-engine.html#syntax-requirements-expression-libraries

    and here:

    https://motiondeveloper.com/blog/write-expressions-external-files

  • Christiaan Vee

    November 28, 2022 at 10:26 am

    Thank you for the reply and the resources, it’s really helpful.

Viewing 1 - 4 of 4 posts

Log in to reply.

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