Filmmaker, Video Editor, Motion Graphics Designer, and Photographer in Cairo, Egypt.
Keeping notes to remember.. You may consider it some sort of Documentation.

Stay In Touch

Sunday, April 2, 2017

Animated Counting Numbers in After Effects With Comma





The Code:
var num = effect("Slider Control")("Slider")
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;
}

References: https://forums.creativecow.net/thread/2/1013878

0 Comments: