Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Can a variable be made of a condition?

  • Can a variable be made of a condition?

    Posted by Andrew Kramer on August 26, 2007 at 12:34 pm

    I need to create a few variables that are conditional, is this possible? I’m sure I can create a workaround but just wondering.

    Var=if (x <= 1) { random(max); } else { min; } Then another conditional script... Thanks, Andrew

    Mike Clasby replied 18 years, 11 months ago 2 Members · 5 Replies
  • 5 Replies
  • Andrew Kramer

    August 26, 2007 at 1:03 pm

    Okay, here is more specifics:

    I need to execute 4 different scripts that are made up of a conditional If/else statement. This is essential.

    These 4 states are dependent on the status of 2 checkboxes.

    Check box 1
    Check box 2

    Here are the four possible states of the 2 check boxes

    A=1. 1 on 2 on
    B=2. 1 on 2 off
    C=3. 1 off 2 off
    D=4. 1 off 2 on

    So I need a conditional statement that will execute a specific conditional expression linked to one of these 4 scenarios.

    something like this:
    if A
    execute script1
    If B
    Execute Script 2
    If C
    Execute Script 3
    If D
    Execute Script 4

    The only problem is that the scripts 1-4 are conditional statements as well.

    So I need something link this?

    if A
    if…
    If B
    if…

    etc.

    I’m working on an alternate solution now, but this would be easier.

  • Andrew Kramer

    August 26, 2007 at 1:31 pm

    Got it, You can just keep puting conditions inside of conditions!

    if (FreqSwitch > 0) {
    if (MaxSwitch > 0) {
    1
    } else {
    2
    }
    } else {
    if (MaxSwitch > 0) {
    3
    } else {
    4
    }
    }

    Then I can replace the numbers with complete conditions and it works perfectly. Sometimes writing things out sure helps.

  • Mike Clasby

    August 26, 2007 at 5:32 pm

    Are you getting in Condition for a new tut?

  • Andrew Kramer

    August 26, 2007 at 11:28 pm

    Not specifically, this is for a cool preset I’m working on. But now that I really have a handle on it, perhaps it is something I could share…

  • Mike Clasby

    August 27, 2007 at 12:59 am

    You share mucho good.

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