After Effects Countdown Expression

Recently I’ve been experimenting with an idea for a countdown video. The first step was to figure out how to make a countdown. Well many guys go in to the timeline, and make text layers that change every second to make it appear to countdown. When you’re talking about a ten minute countdown that can get really tedious, and there was no way I was going to do that. So I came up with an expression to do this. All you have to do is copy and paste it into the “Source Text” expression area and there you go.  If you want to change how long the countdown is, go into the expression and change where it says “dur = 10″ near the beginning of the expression, to “dur = (however many minutes you would like it to be)”. Hope this helps!

offset = 0;

i = inPoint + offset; //the in point of the layer

dur = 10; //the duration of the countdown in minutes

dur *= 60; //the duration of the countdown in seconds

seconds = Math.max(dur - Math.max((time - i), 0),0); //the countdown time in total seconds

minutes = Math.floor(seconds / 60); //the countdown time in minutes

seconds = Math.floor(seconds - (minutes * 60)); //the countdown time in seconds (minus minutes)

if(seconds < 10) seconds = '0' + seconds; //add an additional '0' in front of single digit seconds

if(minutes < 10) minutes = '0' + minutes; //add an additional '0' in front of single digit seconds

minutes + ':' + seconds

One Response to “After Effects Countdown Expression”

  1. Loretta says:

    Andrew, someday when you’re basking in free time, would you take a look at this website and let’s visit about what it would take for you to create a similar project for us to use in our prelude portion before Family Nights. Obviously we’re not using or promoting the curriculum in this video but it does capture my heart for Family Ministry.

    http://whatisorange.org/252basics/

    Let’s talk!

Leave a Reply