FORUMS: list search recent posts

Countdown Timer in After Effects- Trying to remove the movement of digits

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Geoff McLarty
Countdown Timer in After Effects- Trying to remove the movement of digits
on Jul 15, 2015 at 3:37:22 pm

So I've read through many of the forum posts about countdown expression. I know how to create a countdown. Right now, I'm looking to trouble shoot an issue I see with every expression I've used. When the digits change (for example: 10 to 9) there is a shift in the characters from left to right. It's more noticeable with different fonts. I'm looking to eliminate this shift. I don't want the character moving. I'd like them to be fixed. How do I accomplish this with the expression I've posted? Or is there another expression that would work better?

rate = -1;
clockStart = 900;

function padZero(n){
if (n &lt; 10) return "0" + n else return "" + n
}

clockTime = Math.max(clockStart + rate*(time - inPoint),0);

t = Math.floor(clockTime);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
min + ":" + padZero(sec)


Return to posts index

Declan Smith
Re: Countdown Timer in After Effects- Trying to remove the movement of digits
on Jul 15, 2015 at 5:24:26 pm

Try the following. This will force a 2 digit pad on both minutes and seconds. The font will move it a little but each character location should be in a fixed position as per below:



function padZero(str) {
while (str.length &lt; 2) {
str = '0' + str;
}
return str;
}

rate = -1;
clockStart = 900;
clockTime = Math.max(clockStart + rate*(time - inPoint),0);
t = Math.floor(clockTime);
min = padZero(''+Math.floor((t%3600)/60));
sec = padZero('' +Math.floor(t%60));
min + ":" + sec


Declan Smith
http://www.madpanic.tv
After Effects CS6/ FCS3 / Canon XLH1 / Canon 7D / Reason / Cubase

"it's either binary or it's not"


Return to posts index

Kevin Camp
Re: Countdown Timer in After Effects- Trying to remove the movement of digits
on Jul 15, 2015 at 7:00:21 pm

if you issue is the proportional spacing differences between numbers, then i can only think of 3 ways tp fix it.

easiest: use a fixed width font (like courier)

medium: you might be able to use the numbers effect (it has an option to turn off proportional spacing for any font). you'd probably need to try one of the timecode options for formatting and then use a track matte of linear wipe to remove the number fields that you don't need.

hardest: use separate text fields for each digit. I think i'd use the text layer that you have already, and then link the individual text layers for each digit to the sourceText of your current time using substr() to isolate the digit.

to get the first digit (from the 10s value for minutes):

txt = thisComp.layer("MyTime").text.sourceText;
txt.substr(0,1);


and use that for each digit's text layer, modifying the substr() value as needed.

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]