ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Split() Expression to two lines of text

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ryan Kehn
Split() Expression to two lines of text
on May 28, 2019 at 3:42:45 pm

Hello All,

working with the Split() expression on some text. Referencing the composition title to change a text layer, and that works just fine, but what I'm trying to do is take that source text and split each word into it's own line. coming up stumped.

Original expression is as follows on the Source Text of the text layer:

thisComp.name.split("[delimiter}")[#]

played around a little bit with making that a variable and trying to split that up further but not having any luck.

any advice would be appreciated, thanks!

Ryan Kehn
Creative Director
Van Wagner Productions


Return to posts index

Tomas Bumbulevičius
Re: Split() Expression to two lines of text
on May 28, 2019 at 4:09:42 pm

Hey Ryan, few questions:
1. Inside the comp, do you want to additionally break 'splitted' phrase into word per layer?
2. Any chance to see potential comp names?
3. How many text layers do you currently have in the comp?

The thing is - if you are applying your code line to N text layers already(thisComp.name.split("[delimiter}")[#]), and each split part has multiple words - additional amount of layers will be required.

Anyways, answering questions above will give a better understanding.

Find out more:
After Effects Tutorials: motion design, expressions, scripting.
Boxer - Dynamic Text Boxes Template with a Live Preview


Return to posts index

Ryan Kehn
Re: Split() Expression to two lines of text
on May 29, 2019 at 12:20:32 am

Hi Tomas,

Thanks for the reply. Answers to your questions:

1. Essentially, I want a two word string from the comp title to be broken into two lines of text in the comp itself. Want to keep this to one text layer if possible as Element 3D is then being used to extrude the text.

2. Example comp name: "PROMPT_Home Run" where I want "Home Run" to appear on two lines in a single text layer

3. see above:)

Appreciate your insight here!

Ryan Kehn
Creative Director
Van Wagner Productions


Return to posts index


Oleg Pirogov
Re: Split() Expression to two lines of text
on May 29, 2019 at 1:13:21 am

Either I didn't get it right, or this should work:
thisComp.name.split("_")[1].replace(" ", "\n")


Return to posts index

Ryan Kehn
Re: Split() Expression to two lines of text
on May 29, 2019 at 1:19:43 am

Hot Damn! that did it!

thank you so much!

Ryan Kehn
Creative Director
Van Wagner Productions


Return to posts index

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