The Source Text expression in Adobe After Effects allows you to dynamically control and animate the text in a layer using JavaScript-based expressions. This is useful for countdowns, typing effects, random text generation, and dynamic data-driven animation.
🧠 What is Source Text?
Source Text
refers to the actual content of a text layer. Using expressions, you can change the text automatically over time or based on certain values.
🔧 How to Add a Source Text Expression
-
Create a Text Layer
Go toLayer > New > Text
and type anything. -
Open the Expression Field
-
Press
UU
to reveal all modified properties, or simply open the text layer's properties. -
Hold
Alt
(Windows) orOption
(Mac) and click the Stopwatch next to Source Text.
-
-
Type Your Expression
Enter the expression in the provided field.
🧪 Common Source Text Expressions
1. 🔢 Dynamic Number Counter
count = time * 10;
Math.floor(count)
📌 This will animate the text to count up from 0 by 10 units per second.
2. 🧮 Countdown Timer (Seconds)
startTime = 10;
count = Math.floor(startTime - time);
"Countdown: " + count
📌 Counts down from 10.
3. 🎰 Random Text Generator
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
result = "";
for (i = 0; i < 5; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
result
📌 Changes to a random 5-character text every frame.
4. ✍️ Typing Effect
fullText = "Welcome to Learnoy!";
chars = Math.floor(time * 10);
fullText.substr(0, chars)
📌 Text will appear letter by letter like typing.
🧷 Tips and Tricks
-
Use
Math.floor()
to get whole numbers. -
Concatenate strings using
+
operator. -
You can link to other layer values using
thisComp.layer("LayerName").text.sourceText
.
✅ Use Cases
-
Dynamic text changes without keyframes.
-
Clock, countdowns, scoreboards.
-
Simulate digital boards, typing, or hacking effects.
-
Automate text changes via scripts or sliders.
🏁 Final Thoughts
Using Source Text expressions in After Effects makes your animations smarter and more interactive. With just a few lines of code, you can turn static text into dynamic motion elements.