Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions incrementing by 100

  • incrementing by 100

    Posted by Orme Dominique on February 4, 2013 at 9:07 pm

    This is driving me nuts, I can’t seem to get Dan’s currency script to increment by 100 while still having commas and being able to go 5000000. Can someone help me out with this? Banging head agains wall.

    numDecimals = 2;
    commas = true;
    dollarSign = true;
    beginCount = -1999;
    endCount = 1999;
    dur = 4;

    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;
    }else{
    prefix + s;
    }

    numDecimals = 2;
    commas = true;
    dollarSign = true;
    beginCount = -1999;
    endCount = 1999;
    dur = 4;

    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;
    }else{
    prefix + s;
    }

    Orme Dominique replied 13 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 4, 2013 at 9:42 pm

    Try changing the line that defines variable s from this:

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

    to this:

    s = (Math.floor(linear (t, 0, dur, beginCount, endCount)/100)*100).toFixed(numDecimals);

    Dan

  • Orme Dominique

    February 5, 2013 at 8:42 pm

    Worked like a charm. Now I just need to start working these out on my own. Thanks for all your help, Dan.

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