1. Letter-By-Letter Animation

1. Letter-By-Letter Animation

This expression lets you animate text one letter at a time, creating a typing effect that looks like someone is typing on a keyboard.

chars = text.sourceText.length;
timePerChar = 0.1;
visibleChars = Math.floor((time - inPoint) / timePerChar);
text.sourceText.substr(0, visibleChars);

How to Apply

  1. Expand your text layer in the timeline.
  2. Hold the ALT key and click on the stopwatch icon for Source Text.
  3. Paste the expression into the expression box.

Adjusting Animation Speed

By default, the letters reveal at 0.1 second intervals. To slow down the animation, increase the timePerChar value (e.g., 0.5 seconds). If you want finer control:

  1. Add a Slider Control from the Effects > Expression Controls menu.
  2. Link the “timePerChar” value in the expression to the slider.
  3. Customize the slider’s range from 0.1 seconds to 1 second to control the speed dynamically.

2. Word-By-Word Animation

2. Word-By-Word Animation

Want to animate your text word by word? This expression makes it simple and creates a clean, professional reveal effect.

words = text.sourceText.split(" ");timePerWord = 0.2;
visibleWords = Math.floor((time - inPoint) / timePerWord);
words.slice(0, visibleWords).join(" ");

How to Apply

  1. Expand your text layer in the timeline.
  2. Hold the ALT key and click on the stopwatch icon for Source Text.
  3. Paste the expression into the expression box.

Adjusting Animation Speed

By default, the words reveal at 0.2 second intervals. To slow down the animation, increase the timePerWord value (e.g., 0.5 seconds). If you want finer control:

  1. Add a Slider Control from the Effects > Expression Controls menu.
  2. Link the “timePerWord” value in the expression to the slider.
  3. Customize the slider’s range from 0.1 seconds to 1 second to control the speed dynamically.

3. Auto-Resizing Text Box

3. Auto-Resizing Text Box

Creating a perfect background shape for your text that resizes automatically as you update the text is often tedious. These 2 expressions automates the process!

// Copy & Paste This Expression In Text Layer's Anchor Point
top = sourceRectAtTime().top;
left = sourceRectAtTime().left;
x = left + (sourceRectAtTime().width / 2);
y = top + (sourceRectAtTime().height / 2);
[x,y]
// Copy & Paste This Expression In Shape Layer's Size Property
subText = thisComp.layer(index-1);
textWidth = subText.sourceRectAtTime(time).width + 100;
textHeight = subText.sourceRectAtTime(time).height + 100;
[textWidth, textHeight]

How to Apply

  1. Copy the first expression and paste it into the Anchor Point property of the text layer.
  2. Copy the second expression and paste it into the Size property of the shape layer (expand the layer to find the Size property easily by holding CTRL while clicking the layer’s dropdown icon).
  3. Now, whenever you edit the text, the background box will adjust its size automatically.

This is a massive time-saver, especially for creating dynamic text boxes or lower thirds in your animations.


4. In-and-Out Scale Animation

4. In-and-Out Scale Animation

This expression helps you scale text (or any object) in and out smoothly and naturally, adding a polished look to your animation.

scaleDuration = 0.5; // Animation duration - You may connect this to a slider
startValue = 0; // Start value
endValue = 100; // End value
overshootPower = 5; // Overshoot power in percentages
overshootValue = endValue * (1 + overshootPower / endValue);
if (time >= inPoint && time < inPoint + scaleDuration) {
t = (time - inPoint) / scaleDuration;
if (t <= 0.5) {
animatedValue = easeOut(t, 0, 0.5, startValue, overshootValue);}
else {
animatedValue = ease(t, 0.5, 1, overshootValue, endValue);}}
else if (time > outPoint - scaleDuration && time <= outPoint){
t = (time - (outPoint - scaleDuration)) / scaleDuration;
if (t <= 0.5) {
animatedValue = ease(t, 0, 0.5, endValue, overshootValue);}
else {
animatedValue = ease(t, 0.5, 1, overshootValue, startValue);}}
else if (time > outPoint) {
animatedValue = startValue;}
else {
animatedValue = endValue;}
[animatedValue, animatedValue];

How to Apply

  1. Copy the expression and paste it into the Scale property of your text layer.
  2. Adjust the in-and-out points of the layer in the timeline to control when the animation starts and ends.
  3. Modify the “scaleDuration” value to tweak the animation speed, or link it to a slider for easy control.

Bonus Tip

Enable Motion Blur for the layer to make the animation look even more dynamic and professional.


5. Exponential Counter Up

5. Exponential Counter Up

You’ve probably seen videos where numbers or prices increase rapidly. This expression creates that same effect effortlessly.

// Exponential Counter Up Version 1.0
"$" + Math.floor(1000 * Math.exp(time)).toString();
// Exponential Counter Up Version 2.0
var maxNumber = 100000; // The number at which the counter stops
var counter = Math.floor(1000 * Math.exp(time)); // Calculate the current counter value
"$" + Math.min(counter, maxNumber).toString(); // Stop counting when maxNumber is reached

How to Apply

  1. Paste the expression into the Source Text property of your text layer.
  2. Customize the counter by modifying the expression. Replace the default dollar sign “$” with any currency symbol or remove it altogether.
  3. To stop the counter at a specific number, use version 2.0 of the expression. Enter your desired maximum value in the “maxNumber” parameter, and the counter will stop automatically.

Expressions might seem intimidating at first, but they’re powerful tools that save time and make your animations more dynamic. When I started using After Effects, I ignored expressions for years and now regret not learning them sooner.

Mastering even a few simple expressions can drastically enhance your editing workflow.