top of page
Timer Expression

Clock, Dynamic, Time Based Animation
Timer Expression
This expression displays the current composition time in a clean MM:SS format with leading zeros for better readability.
This After Effects expression creates a timer that shows the current composition time in MM:SS format. It calculates minutes and seconds, ensuring each value has two digits by adding a leading zero when needed. This is useful for countdowns, timers, or tracking video duration in a clean, professional format without complex settings or additional plugins.
// Get the current time in minutes and seconds
var t = time;
var minutes = Math.floor(t / 60) % 60; // Minutes
var seconds = Math.floor(t) % 60; // Seconds
// Format the time as HH:MM:SS
var formattedTime = pad(minutes) + ":" + pad(seconds);
formattedTime;
// Function to add leading zero if number is less than 10
function pad(num) {
return (num < 10) ? "0" + num : num;
}
How to Use This Expression?
Create a Text Layer: Add a text layer to your composition.
Apply the Expression: Alt + Click (Windows) or Option + Click (Mac) the stopwatch icon for the Source Text property of the text layer.
Paste the Expression: Copy and paste the provided code into the expression editor.
Adjust the Timer: This expression automatically starts the timer from 00:00 and counts upward. If you want to adjust the starting time, modify var t = time; by adding a value like var t = time + 30; to start from 30 seconds.
Preview the Timer: Play the composition to see the time counter in action.
Trending
bottom of page