ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Dynamic Line Breaks and Measuring Individual Line Lengths

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dan Wegendt
Dynamic Line Breaks and Measuring Individual Line Lengths
on Nov 9, 2017 at 5:03:06 pm

Hello good people!

I'm currently trying to get point text to add a line break after a set number of characters - this much works fine, But then I want to solve for the length of each new line, for a shape layer to fill in behind individual lines of text.

While I have two different scripts created by the incredible Dan Ebberts, I can't seem to figure out how to combine them. It is possible, that it would only be able to measure the length of the original line before the dynamic line breaks are added through expressions though.

Alternately, if it broke the text source into multiple point text layers, that would achieve the same effect. Any ideas?

Here's what I'm working with:

//Dynamic Line Break
txt = value;
n = 20;
outStr = "";
newLine = ""
splt = txt.split(" ")
for (i = 0; i &lt; splt.length; i++){
if ((newLine + " " + splt[i]).length > n){
if (outStr != "") outStr += "\r";
outStr += newLine;
newLine = splt[i];
}else{
if (newLine != "") newLine += " ";
newLine += splt[i];
}
}
if (newLine != ""){
if (outStr != "") outStr += "\r";
outStr += newLine;
}
outStr;


//Line Length Measurement
if (time &lt; 0){
s = value.split("\r");
txt = ""
for (i = 0; i &lt; s.length; i++){
if (time > -10*(i+1)){
txt = s[i];
break;
}
}
txt;
}else


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]