Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Split() Expression to two lines of text

  • Split() Expression to two lines of text

    Posted by Ryan Kehn on May 28, 2019 at 3:42 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

    Ryan Kehn replied 6 years, 11 months ago 3 Members · 4 Replies
  • 4 Replies
  • Tomas Bumbulevičius

    May 28, 2019 at 4:09 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

  • Ryan Kehn

    May 29, 2019 at 12:20 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

  • Oleg Pirogov

    May 29, 2019 at 1:13 am

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

  • Ryan Kehn

    May 29, 2019 at 1:19 am

    Hot Damn! that did it!

    thank you so much!

    Ryan Kehn
    Creative Director
    Van Wagner Productions

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy