Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Altitude expression?

  • Altitude expression?

    Posted by Steve Waldron on October 29, 2010 at 4:24 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.

    Thanks.

    Chris Wright replied 15 years, 6 months ago 3 Members · 6 Replies
  • 6 Replies
  • Walter Soyka

    October 29, 2010 at 5:35 pm

    You may find this thread useful:

    https://forums.creativecow.net/thread/2/925863

    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

  • Chris Wright

    October 29, 2010 at 5:58 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";
    }else{
    prefix + s+ " m";
    }

    https://technicolorsoftware.hostzi.com/

  • Chris Wright

    October 29, 2010 at 6:17 pm

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

    https://technicolorsoftware.hostzi.com/

  • Steve Waldron

    October 29, 2010 at 11:36 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!

  • Steve Waldron

    November 1, 2010 at 10:16 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 += “$”;

    to:
    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!

  • Chris Wright

    November 1, 2010 at 10:02 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 like…at the top

    meterSign = true;
    suffix = “”

    if(meterSign) suffix += “m”;

    outStr + decimals + suffix;
    }else{
    prefix + s+ suffix;

    https://technicolorsoftware.hostzi.com/

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