In this tutorial, I'm going to show how you can take the text of Youtube comment and create a precomp to match the look. I'll show how to use an expression to control the widget of the text box and how you can use Adobe's Essential Graphics to make this precomp resuable. This looks way better than simply taking a screengrab, as you can resize it.
Note: I did spot a slight error, in that I forget in the recording to parent the Thumbs Up layer to the Null object. Do as I say in the audio, not as I do in the video ;)
Expressions Used
AllText = text.sourceText.replace(/(\r\n|\n|\r)/gm,"|");
AllTextLength = AllText.length;
textArray = AllText.split('');
txt = "";
word = "";
boxwidth = 40;
count = 0;
for (var i=0; i < AllTextLength; i++) {
word = word+textArray[i];
if (textArray[i] == ' ') {
txt = txt+word;
word = "";
}
count++;
if (count >= boxwidth) {
count = 0;
txt = txt+"\n";
}
if (i == AllTextLength-1 ) {
txt = txt+word;
} if (textArray[i] == '|') {
txt = txt+word+"\n";
word = ''; count = 0;
}
}
AllTextLength = AllText.length;
textArray = AllText.split('');
txt = "";
word = "";
boxwidth = 40;
count = 0;
for (var i=0; i < AllTextLength; i++) {
word = word+textArray[i];
if (textArray[i] == ' ') {
txt = txt+word;
word = "";
}
count++;
if (count >= boxwidth) {
count = 0;
txt = txt+"\n";
}
if (i == AllTextLength-1 ) {
txt = txt+word;
} if (textArray[i] == '|') {
txt = txt+word+"\n";
word = ''; count = 0;
}
}
txt.split('|').join('');