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 amHi 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 pmin 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 amThanks for your reply Scott, works like a charm. Thanks!
Log in to reply.