Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Text expressions

  • Posted by Wick Van den belt on December 23, 2015 at 1:11 pm

    Dear CC Community,

    I am looking for a few expressions with regard to text layers for a template that I’m building.
    There’s a few questions that I have, and I will try to describe them as good as possible.

    1.
    How can I make an expression that adds a character to a text that is defined in another comp?
    Situation : I have a Main comp which shows a name, comma, and another name. The ‘source text’ of the name is linked to another composition where I have all text layers. Since I want a comma behind the first name, how can I add the comma in this expression?

    What I’m using now is : comp(“Master Text Composition”).layer(“TextLayer1”).text.sourceText

    2.
    I am using several text layers placed after each other with different names. Just like in the previous situation the source text of these layers is defined in a ‘text comp’ where we can easily change all texts. If a text layer is a bit longer than the original one it obviously overlaps with the next text. How can I have the text length or character count influence the position value so that the second layer would move if the first layer has more characters?

    3.
    Is it possible to add ‘…’ to a text layer if the character count exceeds a certain value?
    (Again I am fetching the ‘source text’ from another composition so that I would only have to change the texts in one composition. )

    It would be great if someone could help me out and point me in the right direction here!
    Thanks a lot!

    Wick

    WickieMedia.net

    Wick Van den belt replied 10 years, 8 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    December 23, 2015 at 2:22 pm

    For the first case it would be something like this:

    comp(“Master Text Composition”).layer(“TextLayer1”).text.sourceText + “,”

    The last one could be like this:

    txt = comp(“Master Text Composition”).layer(“TextLayer1”).text.sourceText;
    if (txt.length > 10)
    txt.substr(0,10) + “…”
    else
    txt

    The middle one is more complex, but I would use sourceRectAtTime() to measure the extents of the preceeding text layers to calculate the correct position of each.

    Dan

  • Kalleheikki Kannisto

    December 23, 2015 at 2:31 pm

    (2) If you can combine the two text layers into one (with an expression that adds the second one to the first), that would take care of it. Depends on whether the texts look the same or not.

  • Wick Van den belt

    December 23, 2015 at 9:23 pm

    That was awesome, thanks for the quick help Dan!
    I found a solution for my other question based on your input and another topic here on CC.
    (A topic where you gave the perfect solution as well, as you always seem to do!) Thanks a bunch!!

    Wick.

    WickieMedia.net

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