ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Text align script assistance

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ruben Gomez
Text align script assistance
on Jul 3, 2019 at 5:54:17 am
Last Edited By Ruben Gomez on Jul 3, 2019 at 5:56:10 am

Iam making a 5:00 countdown.. Everytime I have to manually adjust the text to hold the colon ":" in a Fixed position so that the text doesn't keep wobbling left and right for every next digit. Can someone help me with a script that can hold ":" in Fixed position while counting down as well.

I use this script for countdown that I found from creative cow

rate = -1;
clockStart = 300;
delay = 2;

function padZero(n){
if (n < 10) return "0" + n else return "" + n
}
t = Math.max(time - delay,0);
clockTime = Math.max(clockStart + rate*(t - inPoint),0);

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

Thanks


Return to posts index

Tomas Bumbulevičius
Re: Text align script assistance
on Jul 3, 2019 at 8:26:20 am

Hey Ruben, is there a possibility for you to use a different font? It could be your life saviour, to change font into monospaced-type, where each character will keep the same width. As a result - no tedious movements ☺

IF its not possible, then the second easiest option could be break down your result expression into two individual text layers, with ':' layer in between. Set the minutes paragraph to be right sided, seconds - left sided.

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index

Ruben Gomez
Re: Text align script assistance
on Jul 3, 2019 at 9:18:06 am

Thanks Thomas..
I do a lot of countdowns... Sometimes I am lucky to use a monospace font.. Most of the time I had to use other types...
I guess the second idea would work well for all types of fonts...


Return to posts index

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