Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions “IF” Statement Does Not Work

  • “IF” Statement Does Not Work

    Posted by Marius Gudzevicius on May 4, 2017 at 8:15 am

    Hello everyone!

    I’ve been trying to write an expression for position. I want to make it move down when that object’s scale is [100,100]. Scale has an expression that makes it scale from 0 to 100 at any random time in composition. The thing is when I write “if” statement in position expression to check if the scale is 100 or 0 it always works as 100 and I don’t understand why. Can anyone help with that?

    //scale expression for the object:
    seedRandom(1,true);
    rand = random()*thisComp.duration;
    if (time>=rand){[100,100];}
    else{[0,0];}

    //Position expression for the same object:
    scale = content("Group 1").transform.scale; //pickwhiped from scale
    t = time;
    seedRandom(0,true);
    if (scale = [0,0]) {
    y=0; x=0;
    value + [x,y]};
    if (scale = [100,100]){
    y = random()*10 * t ;
    x = 0;
    value + [x,y];}

    Marius Gudzevicius replied 9 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 4, 2017 at 1:22 pm

    For one thin, your if test needs to use the double equal sign operator, like this:

    if (scale == [0,0]) {

    I haven’t tested this, but I think I’d structure the position expression more like this:


    s = content("Group 1").transform.scale;
    if (s[0] < 50){
    value
    }else{
    seedRandom(0,true);
    y = random(10) * time;
    value + [0,y]
    }

    Dan

  • Marius Gudzevicius

    May 4, 2017 at 1:43 pm

    That works perfectly! Thank you Dan!

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