Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions A text based if else statement instead of a value based?

  • A text based if else statement instead of a value based?

  • Ludo Schreuders

    November 26, 2019 at 7:58 am

    Hi Creative Cows,

    For a while now I’ve been searching for a way to use a source text in combination with an if else statement. For example: I have to create a fake social media wall with different profile pictures and matching usernames.

    Let’s say I have a user called ‘Anton’, and I want the profile picture to detect in his username that his name is Anton , so the expression knows what picture to show.

    So what I would like is for the profile pic to have a statement that says something like: “If the source text of the username says ‘Anton’ than show the profile pic of Anton.”

    Anyone knows a way to do something like this? Thanks!

  • Scott McGee

    November 26, 2019 at 2:28 pm

    in Opacity of the profile picture.

    if(thisComp.layer(“Username”).text.sourceText == “Anton”) 100 else 0;

    Then add this too each of the profile pics and swap them in

    Alternative to save hassle, label the profile picture layer Anton etc.

    And do it this way.

    if(thisComp.layer(“Username”).text.sourceText == thisLayer.name) 100 else 0;

    Then you can copy and paste the expression to all layers.

  • Ludo Schreuders

    November 27, 2019 at 8:53 am

    Thanks for your reply Scott, works like a charm. Thanks!

Viewing 1 - 3 of 3 posts

Log in to reply.

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