ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# Counter Control with Expressions

FAQ   •   VIEW ALL
 Counter Control with Expressions on Oct 4, 2012 at 7:54:33 pm

We've been trying to create a flip clock type counter in After Effects for a client video, and have gotten a single digit flip counter in working order, so that as you scrub down the timeline the numbers increment up.

However, we want it to be a three digit counter, and are having trouble thinking of an expression that would make the ten's place holder increment up by 1 only when the one's place holder transitions from 9 to 0.

Can anyone out there help?

 Re: Counter Control with Expressionson Oct 4, 2012 at 8:05:38 pm

Nevermind, on the ten's place precomp we applied a time offset variable and basically divided it by ten.

 Re: Counter Control with Expressionson Oct 4, 2012 at 8:10:30 pm

That's another good solution.

Johnny Cuevas, Editor
Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."
---THOMAS EDISON on inventing the light bulb.

 Re: Counter Control with Expressionson Oct 4, 2012 at 8:10:00 pm

Here's an expression from After Effects Expressions that you might find useful:

``` var startingMinute = 9; var startingSecond = 4; var seconds = Math.floor(time) + startingSecond; var minutes = Math.floor(seconds / 60) + startingMinute; var secondsAsPartsOfAMinute = Math.floor(seconds % 60); function addZeros(rawNumber) { if (rawNumber < 10) return "0" + rawNumber; return "" + rawNumber; } addZeros(minutes) + ":" + addZeros(secondsAsPartsOfAMinute); ```

Johnny Cuevas, Editor
Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."
---THOMAS EDISON on inventing the light bulb.