Countdown Timer
Count down from a specified duration to zero with customizable format.
Expression Code
// COUNTDOWN TIMER
// Apply to Source Text
// === SETTINGS ===
countdownFrom = 10; // seconds to count down from
showMinutes = false; // true for MM:SS format
showMillis = false; // true for decimal seconds
holdAtZero = true; // true = stop at 0, false = go negative
// === COUNTDOWN LOGIC ===
remaining = countdownFrom - time;
if (holdAtZero && remaining < 0) remaining = 0;
// Handle negative (count up after zero)
isNegative = remaining < 0;
remaining = Math.abs(remaining);
min = Math.floor(remaining / 60);
sec = Math.floor(remaining % 60);
millis = Math.floor((remaining % 1) * 100);
function pad(n, digits) {
s = "" + n;
while (s.length < digits) s = "0" + s;
return s;
}
// Build output
result = "";
if (isNegative) result += "-";
if (showMinutes) {
result += pad(min, 2) + ":" + pad(sec, 2);
} else {
result += Math.floor(remaining);
}
if (showMillis) result += "." + pad(millis, 2);
resultApply to a text layer's Source Text property. The timer counts down from countdownFrom seconds to zero.
1. Create a text layer
2. Alt/Option-click the Source Text stopwatch
3. Paste this expression
4. Set countdownFrom to your desired starting value