-
Messing with Dan’s Universal Clock expression
long time lurker, first time poster… (and first timer with expressions).. thanx to all of you who’ve helped me and not even known it.
just looking for opinions on how I accomplished something:
I’m working on a project that called for Dan Ebbert’s universal clock expression; I needed to be able to specify a particular starting time that was non-standard(66 Hrs.) This exp did the trick; it was just math for that part. But I also needed to display frames along with the rest of the time units (for stylistic reasons the time starts at 66:06:06:06)… so I started butchering Dan’s expression to do this. It’s not terribly elegant:
Dan original expression can be found here: https://www.motionscript.com/design-guide/up-down-clock.html
and here’s its remains after I was done with it:(changes in bold)
rate = 1;
FrameRate = rate*30;
clockStart =237966;function padZero(n){
if (n < 10) return "0" + n else return "" + n } clockTime = clockStart + rate*(time - inPoint); clockTimeFrames = clockStart + FrameRate*(time – inPoint);
if (clockTime < 0){ sign = "-"; clockTime = -clockTime; }else{ sign = ""; } tFr = Math.floor(clockTimeFrames);
t = Math.floor(clockTime);
hr = Math.floor(t/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
fr = Math.floor(tFr%30);
sign + padZero(hr) + “:” + padZero(min) + “:” + padZero(sec) + “:” + padZero(fr)Basically it adds a computation alongside everything else to output the frames at 30 times the base rate (simulating 30fps). It works(ish) for what I need it to do, but I was wondering, from the more experienced, what the more elegant way to do it would’ve been. or other ways to do this at all… and if anyone could tell me why this expression skips one frame when displaying the 999th frame, that’d be great, too. 🙂
thanx to all again,
sjp