ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Technique for Animated Number Countdown with Commas

COW Forums : Adobe After Effects

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


David Crowther
Re: Technique for Animated Number Countdown with Commas
on Apr 24, 2017 at 8:00:55 am

New response to old post, this helped me a lot with a project I am working on. However, I used point control instead of slider to overcome the arbitrary 1,000,000 limit.

The expression was (including commas):

var num = effect("Point Control")("Point")[0]

num = Comma(num);
[num]

function Comma(number)
{
number = '' + Math.round(number);
if (number.length > 3)
{
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : '');
for (i=0 ; i < Math.floor(number.length / 3); i++)
{
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}


Posts IndexRead Thread 


Current Message Thread:





© 2017 CreativeCOW.net All Rights Reserved
[TOP]