ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ludo Schreuders
A text based if else statement instead of a value based?
on Nov 26, 2019 at 7:58:37 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!


Return to posts index

Scott McGee
Re: A text based if else statement instead of a value based?
on Nov 26, 2019 at 2:28:50 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.


Return to posts index

Ludo Schreuders
Re: A text based if else statement instead of a value based?
on Nov 27, 2019 at 8:53:49 am

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]