Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Increasing the number of numbers available with timecode (CS6)

  • Increasing the number of numbers available with timecode (CS6)

    Posted by Ben Kahane-rapport on September 15, 2013 at 3:28 am

    Hey all, thanks in advance for reading 🙂
    I’d like to make a countdown that goes second by second, for years. Of course, I don’t want to render years out but I’d like a countdown that starts at, say, 93 years and runs downwards. Right now, I’m using the timecode feature but I’m limited to 4 groups of 2 numbers (00:00:00:00), so those are miliseconds, seconds, minutes, and hours. Does anyone know of a way to make 3 extra sets of zeros, for days, months, and years? Thanks in advance!

    Declan Smith replied 12 years, 11 months ago 2 Members · 3 Replies
  • 3 Replies
  • Declan Smith

    September 15, 2013 at 6:13 pm

    The way I would tackle this is to use an expression on the source of a text object. If I have understood your requirement, you want a counter to countdown 1 year for each real second, with an output that includes: years:months:days:hours:minutes:seconds.

    As a starter for 10, alt/option click the stopwatch of a text layers source attribute and paste the code in below. I have skewed the figures to read zero for all fields except the years right at the beginning of the animation.

    Years is set to 93 as per your initial post. To alter the speed of the counter, you can change the time factor variable (i.e. divide time by some number for slower, or multiply it to speed it up).


    function decrementNumber(num, leading, modulus) {
    num="" + Math.floor(num-((timefactor % 1) *num)) % modulus;
    while (num.length < leading) num='0'+num;
    return num;

    }

    // Variables
    years=93;
    months=12;
    days=364;
    hours=24*days;
    minutes=60*hours;
    seconds=60*minutes;
    timefactor=time;

    // Calculations
    years="" + Math.floor(years-timefactor);
    while (years.length < 2) years='0' + years;

    months=decrementNumber(months,2, 12 );
    days=decrementNumber(days,2, 28 );
    hours=decrementNumber(hours,2, 24 );
    minutes=decrementNumber(minutes,2, 60 );
    seconds=decrementNumber(minutes,2, 60 );

    counter="" + years + ":" + months + ":" + days + ":" + hours + ":" + minutes +":" + seconds

    Declan Smith
    https://www.madpanic.tv
    After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase

    “it’s either binary or it’s not”

  • Ben Kahane-rapport

    September 17, 2013 at 12:05 am

    Wow, thank you so much! Only one problem – it’s being reduced far too fast! How can I control the rate it’s reducing at (and set it to real time). Theoretically, I’d like to be able to make it suddenly decelerate or accelerate. Thank you so much again 🙂

  • Declan Smith

    September 23, 2013 at 12:59 pm

    Perhaps a better solution for this application would be to use the date function and animate epoch (time passed 01/01/1970). The modified code below takes an epoch time as an input. First add an expression control of type ‘Point’ to your text object. This will display, x & y controls. We are just using this as a way of getting data into the expression that can be animated (a slider doesn’t go big enough).

    We only need one of the values to drive our expression, so we will just use the X value. If you put 0 in here, your clock will start at 0. If you put any other epoch time in, then it will evaluate this. For example, put 1379939441 in X on the point control, and it will display:
    43:09:23:13:30:41

    (if you are unfamiliar with epoch times, go here: https://www.epochconverter.com )

    So if you want to countdown from 93 years backwards, then your first value for the X parameter of the point control will be 2934748800, and you can animate via keyframes back to 0 or anywhere in between.

    Let me know if you want me to post up an example project.


    function pad(num, leading) {
    num="" + num;
    while (num.length < leading) num='0'+num;
    return num;
    }

    // Variables
    slider=effect("Point Control")("Point")[0]*1000;
    date = new Date(slider);
    years=pad(date.getYear(date)-70,2);
    months=pad(date.getMonth()+1,2);
    days=pad(date.getDate(),2);
    hours=pad(date.getHours(),2);
    minutes=pad(date.getMinutes(),2);
    seconds=pad(date.getSeconds(),2);

    counter="" + years + ":" + months + ":" + days + ":" + hours + ":" + minutes +":" + seconds

    Declan Smith
    https://www.madpanic.tv
    After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase

    “it’s either binary or it’s not”

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy