Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Stacked if else with multiple var results

  • Stacked if else with multiple var results

    Posted by Jm Chadillon on August 23, 2013 at 2:55 pm

    Basically I’m trying to manually move a layer’s X position only. Being driven from a slider which is also being used elsewhere to drive the source text of another layer.

    Ive never stacked if else / else if before. The code doesnt break anymore, I’ve worked my way through that but I have a problem.

    It seems in my code the value being returned is only the first variable and all other results are omitted all the way through. Im thinking maybe its the way the code is formatted? Maybe I haven’t defined the other potential variables?

    Maybe someone can shed some light on this.

    h = comp("Controller").layer("Eastern Time Control").effect("Hour")("Slider").value;

    if (h = 12){
    x = 960;
    }else if (h = 11){
    x = 800;
    }else if (h = 10){
    x = 700;
    }else{
    x = value;
    }

    [x, value[1]]

    Jm Chadillon replied 12 years, 8 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    August 23, 2013 at 3:17 pm

    Your tests should be using the double equals:

    if (h == 12)

    and your last else should probably have this:

    x = value[0];

    Dan

  • Jm Chadillon

    August 23, 2013 at 3:45 pm

    Thanks Dan,

    What is the significance of the double equal? What is it saying?

    Just for future reference?

  • Dan Ebberts

    August 23, 2013 at 4:48 pm

    (h == 12)

    tests if h is equal to 12

    (h = 12)

    assigns a value of 12 to h

    Dan

  • Jm Chadillon

    August 23, 2013 at 5:07 pm

    Alright that makes much much more sense. Thank you for clearing this up

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