Countdown timer in After Effects: 3 ways to count down minutes and seconds

HomeCountdown timer in After Effects: 3 ways to count down minutes and seconds

After Effects countdown timer cover: a timer showing 00:07

Countdown timer in After Effects: 3 ways to count down minutes and seconds

Numbers dropping from 10 to zero in a launch video. Time running down in an event teaser. In After Effects, a countdown timer is a text layer and a short expression. You also don’t need a plugin. In this note we build the timer in three ways. Then we add hundredths, hours and days. Finally, we fix jumping digits and timers that hit zero too early.

Let us make the video with the countdown

We can shoot and edit your launch, campaign or event video. The countdown, logo animation and on-screen text are part of the edit. Shooting, editing and 3 rounds of revisions start at 15,000 TL + VAT. See our video production service or ask for a quote.

In short

  • A countdown is an expression on the text layer’s Source Text property.
  • The remaining time is turned into seconds. Then it is split into minutes and seconds and written as 00:10.
  • With a Slider and keyframes you can pause or speed up the timer.
  • A keyframe-free expression counts from the moment the layer starts. You change the duration in the first line.
  • In Motion Suite, the Stopwatch / Countdown preset applies in one click.
  • Use Math.ceil so every number stays on screen for a full second.

00:10

Minutes:seconds format

3

Ways to build it

0

Keyframes (ways 2 and 3)

1 s

Time each number stays on screen

Number counter vs countdown timer

Both change a number. However, they do different jobs. A number counter grows a value, for example from 0 to 1,250. A countdown shows time and ends at zero. We covered the number counter in Number counter animation in After Effects.

Number counterCountdown timer
Example0 → 1,25000:10 → 00:00
FormatThousands separator, decimalsMinutes:seconds, hundredths
Driven byA Slider valueElapsed time
Typical useCustomers, revenue, percentagesLaunches, sale endings, exams, live starts

Way 1: a countdown with a Slider and keyframes

Here a Slider holds the time, and the expression writes the digits. Because you set the keyframes yourself, you can pause the timer or slow it down.

  1. Create a text layer: Use Layer › New › Text and type 00:10. That way you see the font and size from the start.
  2. Add a Slider: With the layer selected, apply Effect › Expression Controls › Slider Control.
  3. Set two keyframes: Give the Slider 10 at 0 seconds and 0 at 10 seconds. The slider moves between 0 and 100. For a larger value, right-click the number and widen the range with Edit Value.
  4. Write the expression: Open the layer and Alt-click the stopwatch next to Source Text under Text (Option on a Mac). Then paste this code.
var s = Math.max(0, Math.ceil(effect("Slider Control")("Slider")));
var m = Math.floor(s / 60);
var sec = s % 60;
(m < 10 ? "0" : "") + m + ":" + (sec < 10 ? "0" : "") + sec

First, the code rounds the Slider value up. Then it splits it into minutes and seconds. Finally, it adds a leading 0 to single digits, so 9 seconds reads 00:09. Adobe’s help page on expression controls has more on Slider Control.

The upside of this way is flexibility. For example, two keyframes with the same value in the middle make the timer wait. Similarly, moving the keyframes closer makes it run faster.

Way 2: a keyframe-free countdown expression

If the timer should simply run, you don’t need keyframes. The code measures elapsed time itself. Put this on the text layer’s Source Text:

var duration = 10; // seconds
var t = Math.max(0, time - inPoint);
var left = Math.max(0, Math.ceil(duration - t));
function two(n) { return (n < 10 ? "0" : "") + n; }
two(Math.floor(left / 60)) + ":" + two(left % 60)

The 10 in the first line is the duration in seconds. For instance, 90 starts the timer at 01:30. inPoint is the moment the layer starts. So you set the start by sliding the layer in the timeline. At zero, Math.max(0, …) holds the timer at 00:00.

Math.floor or Math.ceil?

This small choice changes how the timer looks. If you round down, the timer jumps to 00:09 the moment it starts. It also reaches 00:00 after 9 seconds. If you round up instead, every number stays on screen for a full second. Zero then arrives exactly at 10 seconds. That is what viewers expect from a countdown. That is why the code above uses Math.ceil.

Timeline of a 10-second countdown with Math.floor and Math.ceil
The same 10-second countdown. Top: rounding down. Bottom: rounding up.

Adding hundredths

For hundredths you don’t round. Instead, the remaining time is split as it is:

var duration = 10;
var v = Math.max(0, duration - (time - inPoint));
function two(n) { return (n < 10 ? "0" : "") + n; }
two(Math.floor(v / 60)) + ":" + two(Math.floor(v % 60)) + "." + two(Math.floor((v % 1) * 100))

English uses a dot as the decimal separator. In a Turkish video, use a comma instead.

Adding hours and days

For a long countdown, turn the duration into seconds and use the same method. As a reminder, a day is 86,400 seconds and an hour is 3,600:

var duration = 3 * 86400 + 4 * 3600; // 3 days 4 hours
var k = Math.max(0, Math.ceil(duration - (time - inPoint)));
function two(n) { return (n < 10 ? "0" : "") + n; }
var d = Math.floor(k / 86400);
var h = Math.floor(k % 86400 / 3600);
var m = Math.floor(k % 3600 / 60);
d + " days " + two(h) + ":" + two(m) + ":" + two(k % 60)

With frames: timeToTimecode

You can also show the time as timecode. After Effects’ timeToTimecode turns a time into hours:minutes:seconds:frames. For example, at 25 fps it writes 00:00:09:24. However, the default base is 30 frames. So pass your comp’s frame rate as the second value:

timeToTimecode(Math.max(0, 10 - (time - inPoint)), 25, true) // 25: frame rate

The details are in Adobe’s expression language reference.

Way 3: a ready-made countdown in Motion Suite

The Library in Motion Suite, the plugin we built, includes a ready-made countdown. So there is no code to write.

  1. Select the text layer: Pick the text layer where the timer will appear.
  2. Find the preset: Open the Library in the Motion Suite panel. In the Text category, choose Stopwatch / Countdown.
  3. Apply: The panel writes the code to Source Text. It also adds the controls to the layer as effects.
  4. Adjust: Start (s) is 10 by default. With Countdown on, the timer runs from this value to zero. The Hundredths box adds two digits of hundredths.

The preset writes minutes:seconds. With Countdown off, it becomes a stopwatch and counts up from the start value. In an English panel, hundredths are separated with a dot. On several layers, the Stagger option starts the timers one after another.

Still, note one difference. The preset rounds the remaining time down. So a 10-second timer shows 00:00 after 9 seconds. If every number must stay for a full second, use the code from way 2.

Finally, Motion Suite is free until 5 January 2027. You can download it from the Motion Suite page.

Why isn’t my timer working?

The digits jump left and right

In some fonts, 1 and 0 are not the same width. As a result, the text shifts as the numbers change. Pick a font with equal-width digits, or left-align the text instead of centring it.

The timer goes negative

When time runs out, the code returns a negative value. In that case, wrap the remaining time in Math.max(0, …). The timer then stops at 00:00.

The timer starts at the wrong moment

On its own, time counts from the start of the comp. In contrast, time - inPoint counts from the start of the layer. If the timer should move with the layer, use inPoint.

The first number flashes for one frame

Most likely the code rounds down. In that case, use Math.ceil instead of Math.floor. You can also build it with keyframes as in way 1.

How we make videos with countdowns

In launch and campaign videos, we design the countdown as part of the edit. So the process is the same as our video production service:

  1. Idea and script: We set the goal of the video, who it should reach and what it should say.
  2. Shot plan: We plan the location, equipment and shot list in advance.
  3. Shoot: Our team films the planned scenes.
  4. Edit and motion graphics: We cut the footage and add the countdown, logo and on-screen text.
  5. Delivery: We deliver the video in vertical, square and horizontal sizes.

Shooting, editing and 3 rounds of revisions start at 15,000 TL + VAT. For edit-only jobs, we look at the footage first and then send a quote.

Frequently asked questions

Do I need a plugin for a countdown in After Effects?

No. A text layer and a short expression on Source Text are enough. A plugin only saves time.

Can I count down to a specific date?

Yes. Turn the remaining time into seconds and put it in the duration line. However, date functions in expressions read the moment the video is rendered. In other words, they can’t read the viewer’s clock. So a live countdown needs a timer on a website, not a video.

Can the timer show 10, 9, 8 instead of 00:10?

Yes. Delete the last line of the code in way 2 and write just left. The timer then counts down as a single number.

Will the timer render the same way?

Yes, because the expression calculates every frame from time. As a result, preview and render show the same number.

Let’s plan your countdown video

Let us make your launch, campaign or event video from shoot to delivery. Tell us what you need in a few sentences. Then we will send you a clear quote.

Comments are closed