| Thanks Phil,
That's awesome. I ended up going through and doing them all manually, as it allowed me to tweak the line breaks to best suit each sentence. I had a lot of names and titles and doing it by hand made sure they read better over multiple lines than an automated version would have.
But thanks again for the code and this is one to get pasted into the workbook for next time.
Cheers!
-Chris Ok, I modified my expression to make it only break where there are space.
txt = text.sourceText; needABreak=0; newTxt = "";split = 0; splitVal = thisComp.layer("control").effect("Slider Control")("Slider"); for (i=0; i < txt.length; i++) { newTxt = newTxt + txt[i] split++; if (split == splitVal) {needABreak=1} if (txt[i] == " " & needABreak ==1) { split = 0 ; newTxt = newTxt +"\r"; } }
newTxt
Here is a link to the revised project.
Phil
signature1
Phil Spitler
| Creative Technologist | Bonfire
Labs | t : 415.394.8200 m : 415.571.3139
Website | Facebook | LinkedIn
On Oct 1, 2013, at 1:28 PM, Phil Spitler wrote: Ahh. Forgot about splitting words.
Nathan's idea seems a better way to go.
"Is there a way to batch convert point text layers to paragraph text layers and give them all the same bounding box?"
Not sure about batch converting them, but you can make a blank paragraph text layer at the size you want and pick-whip it's source to the existing layer. Then it will create line breaks where there are spaces. I think Phil's expression could break lines in the middle of words?
This could be tedious to set up, so you could duplicate your blank paragraph text layer and have it look at, say, the layer above it for it's source text so you wouldn't have to pick-whip it every time with an expression like this:
thisComp.layer(pullFrom).text.sourceText
... where you apply that expression to the Source Text value for your blank paragraph text layer and place the paragraph layer below the existing text layer in the stack. Then it's just a matter of duplicating that layer.
Dunno. Maybe that helps? - Nathan
|