ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Altitude expression?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Steve WaldronAltitude expression?
by on Oct 29, 2010 at 4:24:23 pm

Hey folks, I'm seeking expression advice - or least I figure an expression will be the best way to do this.

I have a 3D animation from a top down viewpoint of the same location but at different heights. I need to create some text that shows the altitude in metres, the text needs to scramble up in numbers as if updating in real time....

I'm starting on 25m but need to end up in space - to which my storyboard states 24,698,526m.....which is a lot of metres. The 'zoom up' lasts approx 4 seconds, so it's all over in a flash by comparison of the amount of numbers I need to go through....

Any advice - as ever, very gratefully received.


Return to posts index

Dave LaRondeRe: Altitude expression?
by on Oct 29, 2010 at 4:29:04 pm

For a number that big, you'd have to use an expression to increment them. AE's numbers effect won't go that high.

Unfortunately, I stink at expressions, so I'd have to do a search on the COW's AE forum to look it up. I know it's been discussed in the past.

Dave LaRonde
Sr. Promotion Producer
KCRG-TV (ABC) Cedar Rapids, IA

Return to posts index

Walter SoykaRe: Altitude expression?
by on Oct 29, 2010 at 5:35:23 pm

You may find this thread useful:

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events

Return to posts index

Chris WrightRe: Altitude expression?
by on Oct 29, 2010 at 5:58:48 pm

I took the liberty to update Dan's expression for you. It will count as fast as the text layer is long in the project, so just size the text layer as needed. Also, you'll want to go to paragraph-right align text.

numDecimals = 0;
commas = true;
dollarSign = false;
beginCount = 0;
endCount = 24698526;
dur = Math.floor(thisLayer.outPoint);

t = time - inPoint;
s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);

prefix = "";
if (s[0] == "-"){
prefix = "-";
s = s.substr(1);
if(dollarSign) prefix += "$";

if (commas){
decimals = "";
if (numDecimals > 0){
decimals = s.substr(-(numDecimals + 1));
s = s.substr(0,s.length - (numDecimals + 1));
outStr = s.substr(-s.length, (s.length-1)%3 +1);
for (i = Math.floor((s.length-1)/3); i > 0; i--){
outStr += "," + s.substr(-i*3,3);
prefix + outStr + decimals + " m";
prefix + s+ " m";

Return to posts index

Chris WrightRe: Altitude expression?
by on Oct 29, 2010 at 6:17:52 pm

updated a small bug.
dur = Math.floor(thisLayer.outPoint-thisLayer.inPoint);
and then I realized beginCount = 25; /which needs to be fixed.

Return to posts index

Steve WaldronRe: Altitude expression?
by on Oct 29, 2010 at 11:36:19 pm

Wow - you're all very kind to help me out like this.

Thank you very much indeed. I will give this a shot and let you know.

Thanks again, very grateful!

Return to posts index

Steve WaldronRe: Altitude expression?
by on Nov 1, 2010 at 10:16:27 am

Hi guys just a quick question on the revisit on this. It's all working great but in my attempt to futher my knoweldge of expressions I took a bit of inspiration from Dans code and was wondering if it was possible.

Dan uses a $ sign at the start, I was wondering if I could use an M at the end to show it as metres?

I have tried changing the line of code:
if(dollarSign) prefix += "$";

if(dollarSign) sufix += "m";

Which doesn't work, but I am just guessing at the code. Anyone have any better ideas?

Thanks again guys, I really want to get into expressions more as they certainly do the job!

Return to posts index

Chris WrightRe: Altitude expression?
by on Nov 1, 2010 at 10:02:52 pm

the prefix isn't a command, it's a variable
from this...
prefix = "";

it's saying, if(dollarSign) ...or if dollarSign = true, then prefix +="$" add a dollar sign to the variable prefix "" that's now prefix = "$". I already made the code append a "m" to the end of your numbers.

see, down at the bottom there's prefix + s. it's basically $+ number

now if you want to code your own append suffix, you would go the top

meterSign = true;
suffix = ""

if(meterSign) suffix += "m";

outStr + decimals + suffix;
prefix + s+ suffix;

Return to posts index

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