Instead of using any timecode effect, you can very easily do this with expressions :
timeToCurrentFormat();
Apply this expression to a text layer's "source text" parameter.
Steps :
1/Create a text layer (type dummy text)
2/Twirl down to "Source Text"
3/Activate the expression field and paste the expression. It will basically give you the current timecode, so you can't really fake a different timecode (unless you move the layer around in time and precompose)
Create a timecode with expressions
The first argument to timeToCurrentFormat is the time you want to display in seconds. By default this is the current time -- you can display any timecode value this way without precomposing.
For example, timeToCurrentFormat(10)
gives you
0:00:10:00
or apply expr controls to the layer and use this:
timeToCurrentFormat(effect("Slider Control")("Slider")))
to get a slider with arbitrary timecode values
For example, timeToCurrentFormat(10)
gives you
0:00:10:00
or apply expr controls to the layer and use this:
timeToCurrentFormat(effect("Slider Control")("Slider")))
to get a slider with arbitrary timecode values
Hi all,
i've tried the code above and with adding numbers to it to increase the starting TC... however when i add numbers over two digits log the timecode stops running and just shows that static number.
as the timecode shows 00:00:00:00 (hours:mins:secs:frames) i'd love to be able to change the TC to start at for example 02:00:44:00 and then run from there. any ideas on how to make the expression do this without freezing the number?
any help really appreciated
/d
i've tried the code above and with adding numbers to it to increase the starting TC... however when i add numbers over two digits log the timecode stops running and just shows that static number.

any help really appreciated

/d
Apply this expression
Code: Select all
h=5;m=59;s=3;f=7;
f+=timeToFrames();
s+=Math.floor(f*thisComp.frameDuration);
m+=Math.floor(s/60);
h+=Math.floor(m/60);
f=f%(1/thisComp.frameDuration);
s=s%60;
m=m%60;
if(f<10) {f="0"+f}
if(s<10) {s="0"+s}
if(m<10) {m="0"+m}
if(h<10) {h="0"+h}
h+":"+m+":"+s+":"+f
brilliant!!! thanks oscarus! i just checked it out and it works beautifully! kinda get the code too, but what does the '%' do?
thanks.d
thanks.d

-
- Posts: 13
- Joined: July 14th, 2005, 7:33 pm
- Location: VA
- Contact:
It's called the modulus (spelling?) operator. It's pretty much just means "the remainder of the division of the two numbers."
~Colin
~Colin
thanks guys! i've used the above script in different versions now and it workds great!! a quick other question about running numbers...
anybody have and idea how to script a number to run from a single 0 then automatically on to double digit and three digit as it needs?
/d
anybody have and idea how to script a number to run from a single 0 then automatically on to double digit and three digit as it needs?
/d

The following expression will count an increasing monotonic sequence:
The variables are for your convenience. startValue is the number from which to start counting. nFrames is the number of frames for which each value will be displayed. These, of course, may be tied to sliders if you wish.
Code: Select all
var nFrames = 30;
var startValue = 0;
timeToFrames() / nFrames + startValue;
I'm trying the script in AE 7 and entered Ocscarus script, which worked great, except I get the frames going into decimal places. I tried the last script in the thread, thinking that eliminated the problem, but maybe I did it wrong.
Do those two scripts go together? If so, does one go before the other?
I want to keep frames from going into decimal places.
Thanks.
Do those two scripts go together? If so, does one go before the other?
I want to keep frames from going into decimal places.
Thanks.
Steve Bucci
Media Specialist
Media Specialist
-
- Posts: 39
- Joined: November 2nd, 2005, 10:20 am
- Contact:
I just added a Math.round function to the frames and it seems to have fixed the issue.
Phil
h=0;m=0;s=0;f=0;
f+=timeToFrames();
s+=Math.floor(f*thisComp.frameDuration);
m+=Math.floor(s/60);
h+=Math.floor(m/60);
f=Math.round(f%(1/thisComp.frameDuration));
s=s%60;
m=m%60;
if(f<10) {f="0"+f}
if(s<10) {s="0"+s}
if(m<10) {m="0"+m}
if(h<10) {h="0"+h}
h+":"+m+":"+s+":"+f
Phil
h=0;m=0;s=0;f=0;
f+=timeToFrames();
s+=Math.floor(f*thisComp.frameDuration);
m+=Math.floor(s/60);
h+=Math.floor(m/60);
f=Math.round(f%(1/thisComp.frameDuration));
s=s%60;
m=m%60;
if(f<10) {f="0"+f}
if(s<10) {s="0"+s}
if(m<10) {m="0"+m}
if(h<10) {h="0"+h}
h+":"+m+":"+s+":"+f
Phil Spitler
-
- Posts: 39
- Joined: November 2nd, 2005, 10:20 am
- Contact:
The version I just posted seems to have a rounding error.
When I get to 00:00:24:30 ..... it all slips by a frame.
sorry.
Phil
When I get to 00:00:24:30 ..... it all slips by a frame.
sorry.
Phil
Phil Spitler
i needed to create a 72 hour countdown with milliseconds instead of frames.
and so i tried for ages (i've never used expressions before today) to get it to work using the code above. finally got it working
h=71;m=59;s=59;f=99;
f-=timeToFrames(t = time + thisComp.displayStartTime, fps = 3.99 / thisComp.frameDuration, isDuration = false);
s+=Math.floor(f/99);
m+=Math.floor(s/60);
h+=Math.floor(m/60);
f=f%99;
s=s%60;
m=m%60;
if(f<0) {f=100+f}
if(f<10) {f="0"+f}
if(s<10) {s="0"+s}
if(m<10) {m="0"+m}
if(h<10) {h="0"+h}
h+":"+m+":"+s+":"+f
I changed it to f-= and some other stuff too.
can someone please inform me if this is the best way to do this? and/or ways i can improve the code for this task.
cheers
and so i tried for ages (i've never used expressions before today) to get it to work using the code above. finally got it working
h=71;m=59;s=59;f=99;
f-=timeToFrames(t = time + thisComp.displayStartTime, fps = 3.99 / thisComp.frameDuration, isDuration = false);
s+=Math.floor(f/99);
m+=Math.floor(s/60);
h+=Math.floor(m/60);
f=f%99;
s=s%60;
m=m%60;
if(f<0) {f=100+f}
if(f<10) {f="0"+f}
if(s<10) {s="0"+s}
if(m<10) {m="0"+m}
if(h<10) {h="0"+h}
h+":"+m+":"+s+":"+f
I changed it to f-= and some other stuff too.
can someone please inform me if this is the best way to do this? and/or ways i can improve the code for this task.
cheers

I noticed that this cool expression doesn't work with NTSC D1 29.97 video. Anyone out there smart enough to get this to work with Drop Frame and Non-Drop Frame video?
Here is a reference on the math. . .
http://teched.vt.edu/gcc/Html/VirtualTe ... mecode.pdf
This would be very useful.
Thanks,
-David
Here is a reference on the math. . .
http://teched.vt.edu/gcc/Html/VirtualTe ... mecode.pdf
This would be very useful.
Thanks,
-David
f=Math.round(f%(1.001/thisComp.frameDuration));
If you look at the PDF file you will see why this works. time code is not 60 fields per second but 59.97 fields per second, or 001% slower than 60 fields per second. (In my comp I changed all the 60's to 59.97 as well, but it did not seem to matter for the round up)
Anyway this worked for me, then I put the comp in a new comp and used the "Time reverse Layer" command (Under the Layer menu tree) to make it a cound down instead of a count up.
hope this helps.
SMA
If you look at the PDF file you will see why this works. time code is not 60 fields per second but 59.97 fields per second, or 001% slower than 60 fields per second. (In my comp I changed all the 60's to 59.97 as well, but it did not seem to matter for the round up)
Anyway this worked for me, then I put the comp in a new comp and used the "Time reverse Layer" command (Under the Layer menu tree) to make it a cound down instead of a count up.
hope this helps.
SMA
drswoboda wrote:I noticed that this cool expression doesn't work with NTSC D1 29.97 video. Anyone out there smart enough to get this to work with Drop Frame and Non-Drop Frame video?
Here is a reference on the math. . .
http://teched.vt.edu/gcc/Html/VirtualTe ... mecode.pdf
This would be very useful.
Thanks,
-David
oscarus wrote:Apply this expression
Code: Select all
h=5;m=59;s=3;f=7; f+=timeToFrames(); s+=Math.floor(f*thisComp.frameDuration); m+=Math.floor(s/60); h+=Math.floor(m/60); f=f%(1/thisComp.frameDuration); s=s%60; m=m%60; if(f<10) {f="0"+f} if(s<10) {s="0"+s} if(m<10) {m="0"+m} if(h<10) {h="0"+h} h+":"+m+":"+s+":"+f
Thanks Oscarus! This has just really helped me out.
