Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Color from text.sourceText expression

  • Color from text.sourceText expression

    Posted by Scott Mcgee on October 12, 2016 at 1:19 pm

    Hey Guys,

    I’ve been tinkering around with no luck on this one.

    input = thisComp.layer(“color”).text.sourceText;

    if ((input == “red”) == 1 ) [1,0,0,1];
    if ((input == “green”) == 1 ) [0,1,0,1];

    I want something that will work on these lines.

    I have 9 colours, specific values, too which I want to use a text source to define which value it will select.

    I am currently using 9 solid layers and using an expression that will turn on 1 and turn off 8 on the opacity, but my projects are getting bulkier and would like to condense this into one solid layer, with a fill effect that will change color based off the input…

    I know that there must be a way because I’ve seen a forum on here that uses a parse float so it is above or below 0 it will assign one of two colors.

    Any ideas?

    input = thisComp.layer("color").text.sourceText;

    if ((input == "red") == 1 ) [1,0,0,1];
    if ((input == "green") == 1 ) [0,1,0,1];

    Scott Mcgee replied 9 years, 10 months ago 1 Member · 1 Reply
  • 1 Reply
  • Scott Mcgee

    October 12, 2016 at 1:33 pm

    Just incase

    I’ve found, after more searching someone else wanted to do the same.

    So if you are struggling with this and not found their forum.

    Dan Ebberts resolved this one. I was so close yet so far… I will get used to this Java talk.

    txt = thisComp.layer(“TEXTCONTROL”).text.sourceText;
    if (txt == “violet”)
    ([.75,0,1,1])
    else if (txt == “blue”)
    ([0,0,1,1])
    else
    [.5,.5,.5,1];

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