Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Add Prefix & Suffix to an array in sourceText

  • Add Prefix & Suffix to an array in sourceText

    Posted by Roland R. kahlenberg on November 25, 2013 at 9:07 pm

    I’ve got a comp where a user enters the following data into a Text Layer – up to 20 different values are allowed.

    The following is an example of how the text is formatted:
    [ 211 , 251 , 230 , 231 , 155 , 140 , 70 , 214 , 190 , 262 , 210 ]

    In another comp, using a single Text Layer with multiple Range Selectors, I have been able to parse each number and place each number in different places in the comp.

    I would now like the user to be able to add a Prefix and Suffix. These can be typed in another Comp, in another Text Layer. I would like these to be automatically positioned at the front and back of each number.

    Is this possible with a single Text Layer? And if it’s possible,
    what’s the Expressions to achieve this?

    TIA
    RoRK

    Intensive mocha & AE Training in Singapore and Other Dangerous Locations

    Imagineer Systems (mocha) Certified Instructor
    & Adobe After Effects CS6 ACE/ACI

    Marcel Tineo replied 11 years, 8 months ago 3 Members · 2 Replies
  • 2 Replies
  • David Alex

    December 2, 2013 at 3:36 pm

    Hmm, I’m not sure how to solve this particular problem, but when I work with SourceText I find you can add strings.
    Example, I can use a Slider to control a number representing a %, and I need that symbol at the end and the digits within square brackets. I can do it like this:

    "["+Math.floor(effect("Slider Control")("Slider"))+"]%"

    This method doesn’t always work, as I found without the “Math.floor” rounding off the slider the expression doesn’t work, but hopefully it should help with your case, as you can replace the slider reference with a reference to another text layer.

    Hope it helped 🙂

    Ideas to Creations | Motion Graphics, Visual Effects and Digital Art inspiration, tutorials and much more!
    https://ideastocreations.blogspot.com

  • Marcel Tineo

    September 21, 2014 at 4:29 pm

    Yeah!! that worked for me, I only had to delete the… [] and that was it. Thanks!

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