After Effects Tutorial

After Effects: Creating a Countdown Timer

Shae Thompson
|4 min read
Written by Shae Thompson

Loading...

Designing a timer in After Effects may seem complex, but with a little understanding of the software's functions, combined with the use of source text and a slider expression, it can be both fun and rewarding. Here's a more detailed breakdown to create both count-up and countdown timers:

1. Setting the Stage:

Before creating the timer, you need a foundation.

  • Launch After Effects and open your project.
  • Create a new text layer by going to Layer > New > Text, or double-click an existing text layer if you’re retrofitting a previous design.

2. Implementing the Slider Control:

The Slider Control is a versatile tool in After Effects used to generate values which can be linked to other properties.

  • With your text layer selected, navigate to the Effects Panel.
  • Go to Effect -> Expression Controls -> Slider Control. This action integrates a slider, a key component to control how the timer counts.

3. Setting Up the Source Text Expression:

Expressions in After Effects allow you to use JavaScript-like codes to drive animations.

  • In the timeline, expand your text layer to see its properties.
  • Highlight the Source Text property.
  • To solely view the source text, press SS on your keyboard. This shortcut brings the property front and center.
  • Next, hold the Option (for Mac) or Alt (for Windows) key and click the stopwatch icon beside the source text. This procedure enables the expression editor, where you'll input the code.

4. Crafting the Timer Expression:

Here, you're going to define the logic for the timer.

  • Clear any existing text inside the expression editor.

  • Linking the Slider:

    • Type slider = .
    • Use the pick whip tool (a spiral icon) to link slider to the Slider property. This connection allows the text to change as the slider value does.
  • Defining Time Units:

    • frames = Math.floor(slider % 30);
      • Given the project's framerate of 30 frames per second, this equation calculates the frame count.
    • seconds = Math.floor(slider / 30) % 60;
      • This formula computes the seconds and resets after hitting 60 seconds.
    • minutes = Math.floor(slider / 1800);
      • Since 60 seconds make up a minute and we have 30 frames every second, this calculates the total minute count.

5. Display Adjustments:

Formatting ensures a clean and standardized visual representation of time.

  • Utilize the Math.floor function. This function rounds down values, ensuring whole numbers are displayed.
  • Combine minutes, seconds, and frames using colons for clarity:
    • mins + ":" + sec + ":" + frames

6. Including Leading Zeros for a Polished Look:

In time representation, leading zeros (e.g., "09" vs "9") are aesthetically pleasing and standard.

  • Incorporate the function:

    function addZero(n){
        if (n < 10){
            return "0" + n;
        } else {
            return n;
        }
    }
    
  • Apply the addZero function to each time unit to ensure consistency: addZero(mins) + ":" + addZero(sec) + ":" + addZero(frames)

7. Addressing Legacy Expression Issues:

After Effects can occasionally stumble over custom expressions, especially in older projects.

  • If you encounter an error, head to File in the menu.
  • Select Scripts -> Update Legacy Expressions.
  • Choose "All Compositions" and click Update.

8. Breathing Life into the Timer:

Now, make your timer operational with keyframes.

  • Use keyframes on the slider control for animation dynamics.
  • For a span of 20 seconds, input 600 frames, equaling 20 seconds at 30 frames per second.

9. Toggle Between Countdown and Count-up:

Depending on your project, you might need the timer to count upwards or downwards.

  • For a count-up, the initial keyframe starts at 0.
  • For a countdown, invert the keyframes: start with your desired time (e.g., 20 seconds) and conclude at zero.

Closing Thoughts:

With this comprehensive guide, you're now equipped to design dynamic timers in After Effects, adding an extra layer of sophistication to your motion graphics. The power of expressions can't be understated—take this newfound knowledge and let your creativity soar!

Tags

after effects
countdown timer
Shae Thompson
Tutorial
Motion Design

Support Us

If this project file helped you at all, feel free to give us a tip.