ADOBE AFTER EFFECTS: Forum Expressions Tutorials Podcasts Creative Cloud

Letting numbers count up

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Christoph HeimerLetting numbers count up
by on Sep 14, 2016 at 10:14:35 am


I have to animate an interface and there's several numbers in it, which are supposed to either count up from zero, or to change slightly over time, like a heartrate that's supposed to variate a bit.

I stumbled across this problem before but never found out how to do this. I bet it's easier than I think. Can anyone help? :)

Return to posts index

Christoph HeimerRe: Letting numbers count up
by on Sep 14, 2016 at 10:27:10 am

Sorry guys, I was stupid, I found a solution for now with a slider control linked expression.
Now the only problem I have is, if I have a really high number, lets say 82.350. And I want this number to be counted up.
Can anyone tell me how I can make AFX display such a number, instead of just putting out 82350 without the punctuation?

Return to posts index

Walter SoykaRe: Letting numbers count up
by on Sep 14, 2016 at 1:11:50 pm

Below, find an expression that adds basic number formatting to a slider-driven counter. Pro-tip: use an Angle Control instead of a Slider Control to get past its silly 1,000,000 limit. Just type your large value into the degrees field. Ae will convert it to rotations+degrees automatically.

useSeparator = true;
separator = ".";
prefix = "";
postfix = "";

s = "" + parseInt(effect("Slider Control")("Slider"));

if (useSeparator){
sReverse = s.split("").reverse().join("");
outStr = "";
for (i = 0; i <= s.length; i++) {
if ((i % 3 == 0) && (i != 0) && (i != s.length)) outStr = separator + outStr;
outStr = sReverse.substr(i,1) + outStr;
prefix + outStr + postfix;

prefix + s + postfix;

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2016 All Rights Reserved