Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Number Counter Expression

  • Number Counter Expression

    Posted by William France on October 20, 2016 at 1:53 am

    Hey all,

    I’m trying to animate a text layer to increase from 0 to 3,000,000 however I’ve run into a couple of issues. I quickly figured out that the slider control expression is capped to 1,000,000 so after reading over a few posts about how to get around this I’ve ended up with this code which has been applied to an empty text layer (keep in mind I am completely new to writing code like this and thus have copied this from another user’s post with only a basic understanding of how it functions). My issue is that while this code works the way I want, it begins counting at the start of my timeline, instead of where I need it to begin, and if I physically drag the text layer to the point I need, the number freezes on 3000000 instead of counting upwards from zero when played back. Is there something I could add to this expression so that it starts at a specified point in my composition?

    startCount = 0;

    endCount = 3000000;

    countDur = 14;

    Math.round(linear(time,0,countDur,startCount,endCount))

    Liran Tabib replied 8 years, 2 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 20, 2016 at 4:13 am

    Try this:

    tStart = 3; // start 3 seconds into comp
    startCount = 0;
    endCount = 3000000;
    countDur = 14;
    t = Math.max(time-tStart,0);
    Math.round(linear(t,0,countDur,startCount,endCount))

    Dan

  • William France

    October 24, 2016 at 4:52 am

    Thanks Dan, it worked a treat!

  • Liran Tabib

    May 10, 2018 at 7:04 am

    there is a different approach to solve this by Linking the Source Text value to a Slider/Point Control and animating them.
    Counter Preset is based on that solution so you can create any Counter and running numbers animation, with keyframes. I hope you will find it useful. you can get it here:
    https://www.vdodna.com/products/counter-preset/

    Cheers!

    Liran Tabib
    http://www.vdodna.com

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