Activity › Forums › Adobe After Effects › After Effects Text Animation – Display Words one after another
-
After Effects Text Animation – Display Words one after another
Fabrice Leconte replied 5 years, 4 months ago 6 Members · 16 Replies
-
Peter Band
January 19, 2021 at 12:40 amI was looking for a way to display one word at a time in the same place and came across Walter’s expression – it worked great.
Now I am looking to adjust the duration / how long a word is displayed based on its length (number of letters in the word). I tried pre-composing and time-remapping but to no avail.
I know that I can get the number of letters of a word by using layer.text.sourceText.length. But how could I go about using that as a delay or factor to influence how long the word is displayed?
-
Fabrice Leconte
January 19, 2021 at 4:05 amBased on word length.
t = value.split(' ');
w = 0;
c = 0;
for (i = 0; i < t.length; i++) {
if (c < time) {
c += t[i].length;
w = i;
}
}
linear(time, time, c, t[w],t[w])
-
Peter Band
January 19, 2021 at 3:02 pmThank you for your response Fabrice.
It’s not working in my AE (2020). I am getting the expression error “Couldn’t turn result into numeric value” in the first line. I am only getting this error once I put in the for() loop. Seems like a data type issue. I tried parseInt() but didn’t have any luck with that.
-
Fabrice Leconte
January 19, 2021 at 4:45 pmOK, sorry I tried with a numeric string such as:
“1 22 333 4444 55555”
For a string, use:
t = value.split(' ');
w = 0;
c = 0;
for (i = 0; i < t.length; i++) {
if (c < time) {
c += t[i].length;
w = i;
}
}
t[w]
-
Peter Band
January 19, 2021 at 5:08 pmThanks! This is working great.
I inserted another variable to control the overall speed. Now I am wondering how to define a minimum duration for each word to be displayed.
t = value.split(' ');
w = 0;
c = 0;
speedFactor = 0.5;
for (i = 0; i < t.length; i++) {
if (c < time) {
c += t[i].length*speedFactor;
w = i;
}
}
t[w]
-
Fabrice Leconte
January 19, 2021 at 10:52 pmUse Math.max()
t = value.split(' ');
w = 0;
c = 0;
speedFactor = 0.5;
minDur = 2;
for (i = 0; i < t.length; i++) {
if (c < time) {
c += Math.max(t[i].length*speedFactor,minDur);
w = i;
}
}
t[w]
Reply to this Discussion! Login or Sign Up