Forum Replies Created

  • Graham Harris

    September 19, 2017 at 6:52 pm in reply to: Year countdown timer expression problem

    Sorry! It’s been a long day, I realised I had hard coded the time to a single variable so the expression is unable to count up or down. I altered the expression as below and it appears to do what I want, at least I can render it out and then reverse it in premiere to do what I want. Thanks again for your help Andrei.

    countspeed = 100;
    clockStart = 31102010;

    function times(n){
    if (n < 10) return "0" + n else return "" + n
    }

    clockTime = clockStart +countspeed*(time - inPoint);

    if (clockTime < 0){
    minus = "-";
    clockTime = -clockTime;
    }else{
    minus = "";
    }

    totalTimeInSeconds=clockTime
    ;

    secondsPerMinute = 60;
    secondsPerHour = 60 * 60;
    secondsPerDay = 60 * 60 * 24;
    secondsPerMonth = 60 * 60 * 24 * 30;
    secondsPerYear = 60 * 60 * 24 * 30 * 12;

    secondsRemaining = totalTimeInSeconds;

    years = Math.floor(secondsRemaining / secondsPerYear);
    secondsRemaining = secondsRemaining % secondsPerYear;

    months = Math.floor(secondsRemaining / secondsPerMonth);
    secondsRemaining = secondsRemaining % secondsPerMonth ;

    days = Math.floor(secondsRemaining / secondsPerDay);
    secondsRemaining = secondsRemaining % secondsPerDay ;

    hours = Math.floor(secondsRemaining / secondsPerHour);
    secondsRemaining = secondsRemaining % secondsPerHour;

    minutes = Math.floor(secondsRemaining / secondsPerMinute);
    secondsRemaining = secondsRemaining % secondsPerMinute ;

    seconds = secondsRemaining;

    txt = "";
    txt += yearleadingZeros(years);
    txt += leadingZeros(months);
    txt += leadingZeros(days);
    txt += leadingZeros(hours);
    txt += leadingZeros(minutes);
    txt += leadingZeros(seconds);

    txt;

    function yearleadingZeros(i){
    x = "0" + Math.floor(i);
    return x;

    }

    function leadingZeros(i){
    x = "0" + Math.floor(i);
    x = ":" + x.substr(x.length-2, 2);
    return x;

    }

  • Graham Harris

    September 19, 2017 at 6:22 pm in reply to: Year countdown timer expression problem

    Thanks Andrei, I really appreciate you taking the time to look at this. It now displays numbers instead of NA! Unfortunately it doesn’t count down when I run it. Would you have any idea why that is?

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