Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions If/else expressions

  • If/else expressions

    Posted by Michael Davis on December 28, 2011 at 1:36 pm

    Does anyone know a way to tell an expression to search for a range of values in an ‘if’ condition?

    Meaning type into a position field something like:

    if (5a= thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
    if (5<a) { [1200,400];
    }else{ [200,400] };

    Dan Fredley replied 14 years, 7 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    December 28, 2011 at 4:22 pm

    I think you just need to use else if, like this:

    if (a < 5){

    }else if (a < 7){

    }else if (a < 9){

    }else{

    }

    Dan

  • Michael Davis

    December 28, 2011 at 11:13 pm

    Brilliant, thanks Dan.

  • Dan Fredley

    January 3, 2012 at 6:32 pm

    If you find yourself writing a lot of if/else statements, try out the switch function in a javascript manual. It’s a personal preference, but I think it’s cleaner.

    Dan Fredley

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