Activity › Forums › Adobe After Effects Expressions › Fake Youtube Counter
-
Fake Youtube Counter
Posted by Odille Grouillard on December 8, 2014 at 8:43 pmHi guys,
I need to create a fake youtube counter, one that goes from 301 to 215,000,000 (with commas and everything).
I know of to make a counter but not one that has this high a number or commas.
Any help would be great.
Odille Grouillard replied 11 years, 5 months ago 2 Members · 4 Replies -
4 Replies
-
David Conklin
December 8, 2014 at 10:49 pmYou can use the below expression on the source text property of a text layer. There are four variables you can change to suit your purposes. The values I’m gving you count from 301 to 215,000,000 over 60 seconds. Remember that even in a whole minute there are not 215 billion frames, so your steps per frame will be quite large.
The function ‘formatTime’ is what adds the commas. It is taken from this site: https://blog.tompawlak.org/number-currency-formatting-javascript – You should check it out for more info on how it works.
function formatNumber (num) {
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")
}
var beginTime = 0; //time to start counting (seconds)
var finishTime = 60; //time to finish countint (secs)
var beginVal = 301; //first number;
var finishVal = 215000000; //end number
formatNumber(ease(time, beginTime, finishTime, beginVal, finishVal));David Conklin
Motion Designer -
Odille Grouillard
December 9, 2014 at 12:43 amThanks David, this works great.
Just a quick follow up question:The counter starts and 301 and ends at 215,000,000 but the frames in between, it jumps around to random number – 46,005,156 to 51,245,589,358 to 557,971,159,789 etc… – and not progressing in numerical order. Is there anyway around that?
Thanks,
OG -
David Conklin
December 9, 2014 at 2:59 pmHeya. Try this guy. The decimals during the incrimination were causing some problems, this just rounds the numbers. Sorry about that.
function formatNumber (num) {
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")
}
var beginTime = 0; //time to start counting (seconds)
var finishTime = 60; //time to finish countint (secs)
var beginVal = 301; //first number;
var finishVal = 215000000; //end number
var anim = ease(time, beginTime, finishTime, beginVal, finishVal)
formatNumber(Math.round(anim));David Conklin
Motion Designer -
Odille Grouillard
December 9, 2014 at 6:49 pmNo need to apologise, David. You really helped me out.
Thanks again, this is great.
Reply to this Discussion! Login or Sign Up