Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Scientific Notation

  • Scientific Notation

    Posted by Sean Platt on August 31, 2016 at 9:34 pm

    Hi, I have a very basic understanding of expressions and was hoping someone could give me an answer as to NOT reveal scientific notation on output from a counter expression. I am trying to count up to 1sextrillion (21 0’s) and I get the E+21 scientific notation instead.

    I had been using Colin Braley’s suggested script for a counter given on this forum below. Any help is greatly appreciated.

    Thanks!

    startTime = 0; //seconds
    endTime = 5; //seconds
    beginCount = 0;
    endCount = 1000000000000000000000;
    hasCommas = true;
    //--dont modify below here----------------
    function addCommas ( s ){
    if( s.length <= 3 )
    return s;
    else
    return s.substring(0 , 3) + "," + addCommas(s.substring(3, s.length));

    }
    function reverse( s ){
    newStr = "";
    for(i = s.length-1; i >= 0; i--)
    newStr += s.charAt(i)
    return newStr;
    }

    val = Math.round (linear(time, startTime, endTime, beginCount, endCount) );
    if( hasCommas )
    reverse (addCommas(reverse( val + "" )))
    else
    val

    Sean Platt replied 9 years, 8 months ago 3 Members · 4 Replies
  • 4 Replies
  • Miguel De mendoza

    September 1, 2016 at 8:21 am

    In After Effects(and programming in general) you have digit number limit (I dont remember AE limit), so you can’t represent too big numbers literaly. So you might think about split your number in some small pieces, and make linked counters.

  • Xavier Gomez

    September 1, 2016 at 10:49 pm

    Given how big your end number is, you can try cheating a bit: count up to 1000 only, and fill the rest with random digits. Over only 5 seconds, nobody can see anything.

    startTime = 0; //seconds
    endTime = 5; //seconds
    beginCount = 0;
    endCount = 1e21;
    hasCommas = true;

    //--dont modify below here----------------
    function addCommas ( s ){
    if( s.length <= 3 )
    return s;
    else
    return s.substring(0 , 3) + "," + addCommas(s.substring(3, s.length));

    }
    function reverse( s ){
    newStr = "";
    for(i = s.length-1; i >= 0; i--)
    newStr += s.charAt(i)
    return newStr;
    }

    // count up to 1000
    val = Math.round (linear(time, startTime, endTime, beginCount, 1000) );
    val = val.toString();

    // this part adds some random queue up to 21 digits
    if (startTime

    Xavier

  • Sean Platt

    September 1, 2016 at 11:14 pm

    Thanks Xavier! I will try that.

  • Sean Platt

    September 1, 2016 at 11:15 pm

    Thanks Miguel. I was unaware of the limit.

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