Activity › Forums › Adobe After Effects Expressions › AE expression – split text in 2 seperate equal text lines
-
AE expression – split text in 2 seperate equal text lines
Paul Connors replied 7 years, 3 months ago 6 Members · 15 Replies
-
Kalleheikki Kannisto
August 3, 2018 at 6:48 amWith three text boxes, the original one hidden, you can do it this way.
Text layer “source text”: Your original text goes here
Text layer “first text box” source text:
text_array=thisComp.layer("source text").text.sourceText.split("\r");
lines=text_array.length;
mid=Math.round(lines/2);
text_output = "";
for(n=0; nText layer "second text box" source text:
text_array=thisComp.layer("source text").text.sourceText.split("\r");
lines=text_array.length;
mid=Math.round(lines/2);
text_output = "";
for(n=mid; nKalleheikki Kannisto
Senior Graphic Designer -
Paul Connors
January 29, 2019 at 7:52 pmHowdy Dan. Thanks so much for this. It works like a charm! I’m trying to retrofit it to work for three lines instead of two. So, using the original text example of: “Once upon a time there was a princess” that would get split into 3 lines of “Once upon a” “time there was” “a princess”. Is that possible? If so, is it easy to update the expression to work for 3 lines, 4 lines, 5 lines, etc? Thank you!
-
Dan Ebberts
January 29, 2019 at 8:03 pmI think it would get really messy really fast if you tried to set it up to divide the text into 3 or more lines of equal length. Not impossible, just tricky and tedious.
Dan
-
Paul Connors
January 29, 2019 at 10:06 pmThat makes sense. Well, the two lines works amazing! Thank you very much! 🙂
Reply to this Discussion! Login or Sign Up