Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Time in hrs and 10 minute increments Numbers Effect

  • Time in hrs and 10 minute increments Numbers Effect

    Posted by Alistair David on July 13, 2009 at 6:09 am

    Hey Im setting up a counter that tells how long a journey takes in hours and increments of 10 minutes.

    Is there an expression that would make the numbers effect count up in .10 up untill .50 then roll over into the next hour ?

    example

    0.0 min – 0.10 min – 0.20 min- 0.30 min- 0.40 min- 0.50 min – 1.0 hrs – 1.10 hrs etc… ( hrs and min text is on separate layer, only interested in the numbers changing )

    Any help would be awesome.

    Thanks

    AL

    Dan Ebberts replied 17 years ago 2 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    July 13, 2009 at 1:33 pm

    Try using this expression with a text layer’s source text, rather than the Numbers effect:

    rate = 1;
    clockStart = 0;

    clockTime = clockStart + rate*(time – inPoint);

    t = Math.floor(clockTime);
    hr = Math.floor(t/3600);
    min = Math.floor((t%3600)/600)*10;
    hr + “.” + min

    Dan

  • Alistair David

    July 15, 2009 at 11:39 pm

    Hey Thanks Dan !

    It works great The only thing I forgot to mention was it wasn’t in real time, How can I key frame the times I want in there,

    i.e at 5 seconds time is at 0 .10 hrs at 15 seconds time is 1.20 hrs etc

    I have tried to pick whip “clockTime” to a slider but I think the math below is over ruling it still. Will keep fiddling but if you know the expression that would be amazing !

    Thanks Again

    Al

  • Dan Ebberts

    July 16, 2009 at 12:58 am

    If you mean it doesn’t run in linear time, then I guess you’d have to build a table that has all the real times and corresponding clock times and interpolate between them. If you just need it to run at a different rate, you can adjust the clockStart and rate. This gives the values you mentioned:

    rate = 420;
    clockStart = -1200;

    clockTime = clockStart + rate*(time – inPoint);

    t = Math.floor(clockTime);
    hr = Math.floor(t/3600);
    min = Math.floor((t%3600)/600)*10;
    hr + “.” + min

    Dan

  • Alistair David

    July 16, 2009 at 3:48 am

    Hey Dan,

    The first expression you gave me works with a slider, I just have to crank the slider value to 600 to get an increment of 0.10, so it’s sweet.

    check it out

    just trying to figure a way so i dont have to crank the slider to 8000 to get a value of say 2.10. Its no biggy tho.

    Thanks heaps for your time,I really appreciate it 🙂

    Al

  • Dan Ebberts

    July 16, 2009 at 1:33 pm

    Ah. Something like this would let your slider represent hours instead of seconds:

    clockTime = thisComp.layer(“Time Controls”).effect(“Time”)(“Slider”);

    hr = Math.floor(clockTime);
    min =Math.floor(linear(clockTime%1,0,1,0,.6)*10);
    hr + “.” + min

    Dan

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