ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Counter script: space between numbers

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Etienne ButeauCounter script: space between numbers
by on May 14, 2012 at 2:21:24 am

Hi !

I want to do a counter to 100 000 to 1 000 000.

Here is the script I use:

startT = 1;
endT = 5;
beginVal = 100000;
endVal = 1000000;
t = linear(time,startT,endT,beginVal,endVal);
t.toFixed(0)

Everything is working fine. But I would like to keep the space between the numbers (100 000 instead of 100000)

A friend told me to put this script '' .replace(/(d{3})/gi, '$1 ') '' at the end of my script. It work with 100 000 but not for 1 million: 100 000 0

Someone can help me ?

thank you !


Return to posts index

Etienne ButeauRe: Counter script: space between numbers
by on May 14, 2012 at 9:31:41 pm

up !


Return to posts index

Dan FredleyRe: Counter script: space between numbers
by on May 16, 2012 at 12:35:11 pm

Try this:

startT = 1;
endT = 5;
beginVal = 100000;
endVal = 1000000;
t = linear(time,startT,endT,beginVal,endVal);
t += "";
t.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1 ");


Dan Fredley


Return to posts index


Marcin StaszewskiRe: Counter script: space between numbers
by on Apr 24, 2016 at 2:36:09 pm

Thanks Dan!
I know this thread is pretty old, but it still saved me today :)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]