Lucas, try this one below. The splitter function I had in my library developed by someone else. Adding random phrase of text will split into different lines. Plain text layer works (No area text is required), no rescalling will be introduced either.
Define your layer in textSource, and charsPerLine number. This is pretty much it, but some super long words are cutted, Maybe someone could improve it based on this example.
Keep the line dynamic by linking its Y position to the height of the text.
textSource = thisComp.layer(3).text.sourceText;
charsPerLine = 30;
function splitter(str, l){
var strs = [];
while(str.length > l){
var pos = str.substring(0, l).lastIndexOf(' ');
pos = pos <= 0 ? l : pos;
strs.push(str.substring(0, pos));
var i = str.indexOf(' ', pos)+1;
if(i < pos || i > pos+l)
i = pos;
str = str.substring(i);
}
strs.push(str);
return strs.toString();
}
outputString = splitter(textSource, charsPerLine);
numLines = outputString.split(",").length;
res = "";
for (var j=0; j<numLines; j++){
res = res + outputString.split(",")[j] + "\n";
}
res
Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer – Dynamic Text Boxes Template with a Live Preview
Social Media Profiles