FORUMS: list search recent posts

Clock/timer that updates every 2 seconds

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Matthew Reilly
Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 1:57:41 pm

Hi there Im not that great with expressions…. and I need clock/timer that counts up in clock format but only updates every 2 seconds
e.g.

20 being hours / 56 minutes / 18 seconds
20:56:18
20:56:20
20:56:22
20:56:24

Also the time needs to be able to be set.
can any one help or at least point me in the right direction?

Thanks Matu


Return to posts index

Dan Ebberts
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 2:51:50 pm

Probably something close to this:

startHr = 20;
startMin = 56;
startSec = 18;

function pad(n){
str = "" + n;
if (str.length < 2) str = "0" + str;
return str;
}
tStart = startHr*3600 + startMin*60 + startSec;
delta = Math.floor((time - inPoint)/2)*2;
t = tStart + delta;
h = Math.floor(t/3600)%24;
m = Math.floor((t%3600)/60)
s = t%60
"" + pad(h) + ":" + pad(m) + ":" + pad(s)


Dan



Return to posts index

Matthew Reilly
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 3:18:23 pm

Cool that works but just one more thing is it possible to get it to update every frame? so it is more like a time stamp to that frame

thanks for the help

Mat


Return to posts index


Dan Ebberts
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 3:31:08 pm

I'm confused. Does that mean you want it to update more often than every two seconds? Even if it updates every second, it won't change every frame. Or are you asking for a different time format that includes frames?

Dan



Return to posts index

Matthew Reilly
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 3:33:05 pm

sorry for the confusion that is my fault

You did what I asked for but then I realised that I would need the time to jump by 2 seconds every for frame so it is more of a timestamp to every frame.

Mat


Return to posts index

Dan Ebberts
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 3:48:31 pm

Ah, OK -- like this then:

startHr = 20;
startMin = 56;
startSec = 18;

function pad(n){
str = "" + n;
if (str.length < 2) str = "0" + str;
return str;
}
tStart = startHr*3600 + startMin*60 + startSec;
delta = Math.floor(timeToFrames(time - inPoint))*2;
t = tStart + delta;
h = Math.floor(t/3600)%24;
m = Math.floor((t%3600)/60)
s = t%60
"" + pad(h) + ":" + pad(m) + ":" + pad(s)


Dan



Return to posts index


Matthew Reilly
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 3:53:10 pm

Ok that is now counting up in 2's for every frame but it seems to have lost the time formatting... is there something Im missing?

Mat


Return to posts index

Dan Ebberts
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 3:58:27 pm

30 frames in, I'm getting "20:57:18". What are you getting?

Dan



Return to posts index

Matthew Reilly
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 4:01:10 pm

Im getting just 720

edit "hold on.... my bad I missed some of the last bit of the code"


Return to posts index


Dan Ebberts
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 4:08:38 pm

Are you sure you pasted in the whole expression? I just tried it (copied and pasted from my post) and it works for me.

Dan



Return to posts index

Matthew Reilly
Re: Clock/timer that updates every 2 seconds
on Aug 30, 2012 at 4:10:58 pm

Yeah I updated my last post... I missed the last part of the expression because I copied it out of the gmail reply which cuts of the post.... DOH but it is working now like a dream thanks Dan ;)

very helpful


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]