ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

counting up number with this expression but using COMMAS

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Robert Paynter
counting up number with this expression but using COMMAS
on Nov 8, 2006 at 8:36:07 am

is there anymay to get the commas to show up when using this expression on a text layer to count up?

startCount = 0;
endCount = 500000;
countDur = 200;
Math.round(linear(time,0,countDur,startCount,endCount))


Return to posts index

Mylenium
Re: counting up number with this expression but using COMMAS
on Nov 8, 2006 at 12:27:53 pm

Treat each group of numbers separately or separate their substrings. I think Dan, Filip or yikesmikes expalined it (again) not so long ago and provided the code, so do a search.

Mylenium

[Pour Myl


Return to posts index

Mylenium
Re: counting up number with this expression but using COMMAS
on Nov 8, 2006 at 12:32:17 pm

Some inspiration here:

http://forums.creativecow.net/cgi-bin/new_read_post.cgi?forumid=2&postid=88...

Mylenium

[Pour Myl


Return to posts index


Dan Ebberts
Re: counting up number with this expression but using COMMAS
on Nov 8, 2006 at 3:02:20 pm

This should do it as long as you don't go above 999,999:

startCount = 0;
endCount = 500000;
countDur = 200;
s = "" + Math.round(linear(time,0,countDur,startCount,endCount));

if (s.length > 3){
s.substr(0, s.length -3) + "," + s.substr(-3);
}else{
s
}

Dan



Return to posts index

Jefferson Ballew
Re: counting up number with this expression but using COMMAS
on May 14, 2015 at 4:43:12 pm

Alright all you scripting geniuses, is there any way to add a millions place comma as well, for those times when you have to go over a million? I tried to figure it out, but couldn't seem to make it work.


Return to posts index

Dan Ebberts
Re: counting up number with this expression but using COMMAS
on May 14, 2015 at 5:21:40 pm

I hope this pastes in correctly (it has a few backslashes in it which seem to cause problems some times):


startCount = 0;
endCount = 500000;
countDur = 200;
s = "" + Math.round(linear(time,0,countDur,startCount,endCount));
s.replace(/\B(?=(\d{3})+(?!\d))/g, ",");



Dan



Return to posts index


Jefferson Ballew
Re: counting up number with this expression but using COMMAS
on Jul 27, 2015 at 11:33:14 pm

Sweet! you rock!


Return to posts index

alex bee
Re: counting up number with this expression but using COMMAS
on Jul 5, 2017 at 3:52:54 pm

Hello Dan

Could you please kindly tell me if you can put a "+" sign at the end of a counting up 70,000 with comma?

Thank you so much.
Alex


Return to posts index

Michael Heid
Re: counting up number with this expression but using COMMAS
on Mar 19, 2020 at 1:35:17 am

If Dan Ebberts ever decides to stop being helpful, all of the motion graphics community will crumble. Thank you so much sir! I don't think you can comprehend what your contribution has done for me and after effects users around the world. Thank you, thank you, thank you!


Return to posts index


Liran Tabib
Re: counting up number with this expression but using COMMAS
on Apr 22, 2016 at 7:09:53 am

Counter Preset has commas as default, and you can change them to any other character if you want: http://www.vdodna.com/products/counter-preset/
I hope you will find it Useful


Return to posts index

Nick Khoo
Re: counting up number with this expression but using COMMAS
on Jan 19, 2017 at 10:15:07 pm

Hey I realise this post is almost a decade old but I just posted a video solution that can give you commas up to 999,999,999,999







Return to posts index

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