Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects How do you create an expression?

  • How do you create an expression?

    Posted by Bobby Boris on September 19, 2010 at 9:01 pm

    I’ve been looking up how to do a clock expression (like in this link)
    https://www.motionscript.com/design-guide/up-down-clock.html

    and I’m glad such a thorough explanation is provided, but I don’t know where to put it! I have adobe after effects cs3 professional. I vaguely only know that to put this expression in your video you have to have a .jsx file, it has to be in UTF-8 encoding, and something about javascript. But when I go to file>scripts>open script editor nothing happens, and when I copy and paste this copy and paste code from the link in this post:

    rate = -2;
    clockStart = 3604.999;

    function padZero(n){
    if (n < 10) return “0” + n else return “” + n
    }

    clockTime = clockStart + rate*(time – inPoint);

    if (clockTime < 0){
    sign = “-“;
    clockTime = -clockTime;
    }else{
    sign = “”;
    }

    t = Math.floor(clockTime);
    hr = Math.floor(t/3600);
    min = Math.floor((t%3600)/60);
    sec = Math.floor(t%60);
    ms = clockTime.toFixed(3).substr(-3);
    sign + padZero(hr) + “:” + padZero(min) + “:” + padZero(sec) + “.” + ms

    When I paste that into a notepad and then encode it to utf-8 and change the extension to .jsx and go to file>scripts>run script file and click my jsx file it says Unable to execute script at line 8. time is undefined. On the eighth line I see this:
    clockTime = clockStart + rate*(time – inPoint); and I’m not sure what to change, clockTime or time? And I just don’t know how to insert this javascript into aE. Thanks

    Todd Kopriva replied 15 years, 8 months ago 4 Members · 3 Replies
  • 3 Replies
  • Brian Charles

    September 19, 2010 at 9:30 pm

    Expressions are placed on the property you wish to control with the code. You need to alt/option click on the stopwatch for the property and then paste the code there.

    Expressions are NOT the same thing as After Effects scripts. Scripts in After Effects are like macros which control production workflow, they are jsx files and are either simple jsx or compiled jsx which are placed in the Scripts folder inside the After Effects application folder. They are then available either through the Edit menu (Edit>Run Script) or through the Window menu if they are the appropriate type of script and have been placed in the Scripts UI Panels folder in the Scripts folder.

    Plain scripts can also be invoked from the Edit >Run Script command when they are located elsewhere on your computer, they don’t have to be placed in the Scripts folder to work.

    You were trying to run an expression (something that drives effects parameters or keyframes) as a Script, just won’t work.

  • Andy George

    September 19, 2010 at 9:30 pm

    Expressions and scripts are different creatures. Expressions are applied directly to an attribute your controlling rather than “run” like a script.

    This expression would be applied to the source text property. Click on the arrow to the left of the text to twirl down the properties. Option+Click on the stopwatch next to the source text property to reveal the expression box. Paste your expression there.

    -Andy George
    Senior Editor
    http://www.chiselindustries.com

  • Todd Kopriva

    September 19, 2010 at 11:32 pm

    There’s basic information about expressions here, including a link to a simple introductory video.

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    Technical Support for professional video software
    After Effects Help & Support
    Premiere Pro Help & Support
    ———————————————————————————————————

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