ADOBE AFTER EFFECTS: Forum Expressions Tutorials Podcasts Creative Cloud

How do you create an expression?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bobby BorisHow do you create an expression?
by on Sep 19, 2010 at 9:01:08 pm

I've been looking up how to do a clock expression (like in this link)

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;
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

Return to posts index

Brian CharlesRe: How do you create an expression?
by on Sep 19, 2010 at 9:30:34 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.

Return to posts index

Andy GeorgeRe: How do you create an expression?
by on Sep 19, 2010 at 9:30:41 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

Return to posts index

Todd KoprivaRe: How do you create an expression?
by on Sep 19, 2010 at 11:32:24 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

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2016 All Rights Reserved