Last active
August 24, 2022 02:32
-
-
Save MarissaJ/5d95fa08114c612de1064fe20841074f to your computer and use it in GitHub Desktop.
After Effects Data Driven Expression- Line Break Control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 2 is a duplicate and not needed.