Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Extracting part of value of source text

  • Extracting part of value of source text

    Posted by Kirill Skorodelov on August 25, 2015 at 1:41 pm

    Hi,

    I’m trying to write a short expression which can extract different part of source text and pass it on to another property

    So say the text layer called “color” contains this value 0.23545;0.65758;0.34675

    And in the same comp there’s a solid layer “solid” which color can be driven by expression. This expression should produce [w,x,y,z]. in my case z will always be 0, so I’ll need a result of [w,x,y,0]. And these w,x and w should take part of values from the source text “color”.

    I believe this expression for “solid” layer should look like that
    w=thisComp.layer(“color”).text.sourceText. and some rule for taking just the first bit of value before first semicolon;
    x=thisComp.layer(“color”).text.sourceText. and some rule for taking the second bit of value after first semicolon and before the second one;
    y=thisComp.layer(“color”).text.sourceText. and some rule for taking third bit of value after the second semicolon;
    [w,x,y,0]

    At the end this expression should produce [0.23545,0.65758,0.34675,0]

    Thanks a lot in advance for your help,
    Kirill

    Kirill Skorodelov replied 11 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    August 25, 2015 at 3:59 pm

    Like this:

    txt = thisComp.layer(“color”).text.sourceText.split(“;”);;
    w = parseFloat(txt[0]);
    x = parseFloat(txt[1]);
    y = parseFloat(txt[2]);
    [w,x,y,0]

    Dan

  • Kirill Skorodelov

    August 25, 2015 at 5:08 pm

    Thanks a million, Dan!

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