In order to add the code. Create a new blank text layer, click on the "Text" drop-down in the composition and the Alt-click on the "Source Text" stopwatch. Paste the code in the right column as seen in this screenshot.

Here's the code:

```
countspeed = 1;
clockStart = 0;
```

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 = "";

}

t = Math.floor(clockTime);

h = Math.floor(t/3600);

min = Math.floor((t%3600)/60);

sec = Math.floor(t%60);

ms = clockTime.toFixed(2).substr(-2);

if (clockTime>__30__) {

"__DING!__"

} else {

minus + times(h) + ":" + times(min) + ":" + times(sec) + "." + ms

}

EDIT: in the comments someone asked how to make this in to a countdown timer. You can find my response below or you could use the following code...

Here's the code:

```
countspeed = -1; clockStart =
```**20**; clockStop =0;

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 = "";

}

t = Math.floor(clockTime);

h = Math.floor(t/3600);

min = Math.floor((t%3600)/60);

sec = Math.floor(t%60);

ms = clockTime.toFixed(2).substr(-2);

if (clockTime < clockStop) {

"__DING!__"

} else {

minus + times(h) + ":" + times(min) + ":" + times(sec) + "." + ms

}

I hope you enjoy!

After Effects, Freebies, Tutorials, Video post by Darren.

this would be really usefull if only one could copy and paste the code….

ooops, soooo sorry, I was trying to copy and paste to desktop – did not realise you could do a direct paste! THANKS SO MUCH FOR THIS CLOCK!

Thank you so much for this code!!!

I modyfieid it a bit to count 4 minutes every second and start at 95 hours. For some reason it wasn’t counting past 100 but if you added a new time unit without defining it it counted past 100. I used it in my school project if that’s ok.

I’m happy you found a use for it! Feel free to use it with anything you like, that’s why I shared it

How would I reverse this into a countdown? Thanks ahead.

I’m no coder but after playing around I figured out how to do it. To set your countdown time change the 20 to your desired number in the first line.

countspeed = -1; clockStart =20; clockStop =0;

function times(n){

if (n < 10) return "0" + n else return "" + n

}

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

if (clockTime < 0){

minus = "";

}else{

minus = "";

}

`t = Math.floor(clockTime);`

h = Math.floor(t/3600);

min = Math.floor((t%3600)/60);

sec = Math.floor(t%60);

ms = clockTime.toFixed(2).substr(-2);

if (clockTime < clockStop) {

"DING!"

} else {

minus + times(h) + ":" + times(min) + ":" + times(sec) + "." + ms

}

Thanks so much!