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; |
Hey buddy, where the file? ) can you provide it to me?
Line 2 is a duplicate and not needed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/