<p>Option 1 - use a fixed width font, and make sure the text layer you create is left aligned. You'll need to select the text in your layer before you switch the paragraph to left alignment.</p>
<p>Option 2 -  Do something like this (I'm sure there's a nicer way to do it), but from looking at <a href="https://mediarealm.com.au/articles/after-effects-countdown-timer-expression/" rel="nofollow noreferrer">this script for countdown timers</a>, and <a href="https://ukramedia.com/charat-expression-in-after-effects/" rel="nofollow noreferrer">this script for finding the right character</a>, I hacked up this:</p>
<p>Make a text layer for each character.</p>
<p>Make sure each text layer is left aligned.</p>
<p>Put this in the source text expression of each character you want to control:</p>
<pre><code>st = 300;  
t = st - time;  
c = timeToTimecode(t);  
c = c.substring(4,8)
output = c.charAt(3);
output
</code></pre>
<p>Change the “charAt” variable for each position. Eg 0 is the furthest right character, and (3) would be the furthest left character (the minute).</p>
<p><a href="https://i.sstatic.net/lk0q1.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lk0q1.jpg" alt="grab" /></a></p>

CC BY-SA 4.0
2023-03-22T20:06:36.573Z
2023-03-22T22:18:13.610Z
2023-03-22T22:18:13.610Z
tomh
<p>Using After Effects, I am trying to do a countdown of 5 minutes with a setup like this: 5m 00s, 4m 59s, 4m 58s... I have the countdown already set up with Slider Control. However, I'm trying to use a mask for each character separately, which I also mostly have under control, except I realized that the text moves when the width of the text box changes as the text changes, for example, 2m 00s vs 1m 59s because of the width of the character &quot;1&quot; is smaller than &quot;2&quot; in the font I am using. Is there a way I can make the text box width, specifically each character's placement, not change even while Slider is in use? I have already gotten started on creating changes to the mask each time it changes, but I have a feeling it will be a lot of work.</p>

<after-effects><after-effects-expressions>
After Effects: How to keep text same width through changes
leguchi
# After Effects: How to keep text same width through changes

(Asked by: username_0 on 2023-03-22)

Using After Effects, I am trying to do a countdown of 5 minutes with a setup like this: 5m 00s, 4m 59s, 4m 58s... I have the countdown already set up with Slider Control. However, I'm trying to use a mask for each character separately, which I also mostly have under control, except I realized that the text moves when the width of the text box changes as the text changes, for example, 2m 00s vs 1m 59s because of the width of the character "1" is smaller than "2" in the font I am using. Is there a way I can make the text box width, specifically each character's placement, not change even while Slider is in use? I have already gotten started on creating changes to the mask each time it changes, but I have a feeling it will be a lot of work.

**Tags:** after-effects, after-effects-expressions


---

## 1 answers

### Answer by username_1 on 2023-03-22. Score: 0

Option 1 - use a fixed width font, and make sure the text layer you create is left aligned. You'll need to select the text in your layer before you switch the paragraph to left alignment.
Option 2 -  Do something like this (I'm sure there's a nicer way to do it), but from looking at this script for countdown timers, and this script for finding the right character, I hacked up this:
Make a text layer for each character.
Make sure each text layer is left aligned.
Put this in the source text expression of each character you want to control:
st = 300;  
t = st - time;  
c = timeToTimecode(t);  
c = c.substring(4,8)
output = c.charAt(3);
output

Change the “charAt” variable for each position. Eg 0 is the furthest right character, and (3) would be the furthest left character (the minute).


---

