Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
After Effects Data Driven Expression- Line Break Control
row = parseInt(thisComp.layer("Data-Sample.csv")("Data")("Number of Rows")-1);
thisComp.layer("Data-Sample.csv")("Data")("Outline")("Long Text")("Long Text " + row)
txt = thisComp.layer("Data-Sample.csv")("Data")("Outline")("Long Text")("Long Text " + row);
n = effect("Line Break")("Slider");
outStr = "";
newLine = "";
splt = txt.split(" ");
for (i = 0; i < 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;
@MarissaJ

This comment has been minimized.

Copy link
Owner Author

commented Nov 20, 2018

For more on how to use this expression and download a sample After Effects 2019 file here https://www.fluxvfx.com/data-driven-expressions-for-after-effects-2019/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.