Expression: Text Typing Animation
As a bonus, we’ve created an expression to animate typing with a blinking cursor. Even though a task like this is pretty rare, there might have been at leat one time in your life when you did that manually. So, how does it work? Add this expression to the Source Text parameter. In the first line, you can set a cursor symbol, and also set the blink time in the second line.
cursor = "|";
blinkTime = 1;
charMod = 1;
num = effect("Slider Control")("Slider");
toggle = effect("Checkbox Control")("Checkbox");
if (toggle == 1) {
t = ((time - inPoint) / blinkTime) % 1;
if (num.numKeys > 2) {n = 0} else {n = 1}
ux = Math.abs(num.speedAtTime(time + thisComp.frameDuration*n));
blink = Math.round(ux + t);
if (blink == 0) {
cursor = " ";
}
} else {
cursor = " ";
}
if (charMod == 0) {
textAnim = num * text.sourceText.length / 100;
} else {
textAnim = num;
}
text.sourceText.substr(0, textAnim) + cursor