Copy link to clipboard
Copied
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.
Project download: https://bit.ly/3b8Agvt
Expression 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;
}
}
txt.split('|').join('');
Copy link to clipboard
Copied