Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How can I affect the position of a Null based on multiple Checkbox Controls?

  • How can I affect the position of a Null based on multiple Checkbox Controls?

    Posted by Angel Alcantara on June 5, 2018 at 10:10 pm

    Hello everyone, I’ll try to be as clear as possible with what I’m trying to do:

    I have a series of diamonds, 9 of them to be exact. They are all parented to a Null object, and that Null is positioned on the top right of the composition. I have a layer called “Total Diamonds”, with multiple Checkbox Controls inside. Each Checkbox Control will be for how many diamonds (3 ~9 [3 being the minimum, 9 the maximum]) I want to have visible on the screen at a time, while still maintaining their right-aligned orientation on the composition. (This is vital. I want them to stay right-aligned. I know I can just pick-whip the Opacity to a checkbox control or slider, but instead, I want to shift them off-screen behind a Silhouette Alpha layer I have.)

    On the Null (the one controlling the position of the diamond, I added the following expressions:

    if (thisComp.layer(“Total Diamonds”).effect(“8”)(“Checkbox”) ==1) [799.4,70.0] else [741.7,70.0];
    if (thisComp.layer(“Total Diamonds”).effect(“7”)(“Checkbox”) ==1) [856.7,70.0] else [741.7,70.0];
    if (thisComp.layer(“Total Diamonds”).effect(“6”)(“Checkbox”) ==1) [914.5,70.0] else [741.7,70.0];
    if (thisComp.layer(“Total Diamonds”).effect(“5”)(“Checkbox”) ==1) [972.0,70.0] else [741.7,70.0];
    if (thisComp.layer(“Total Diamonds”).effect(“4”)(“Checkbox”) ==1) [1029.7,70.0] else [741.7,70.0];
    if (thisComp.layer(“Total Diamonds”).effect(“3”)(“Checkbox”) ==1) [1087.2,70.0] else [741.7,70.0];

    That being said, I am 100% sure I am doing something incredibly wrong. I don’t know if the position of an object can or can’t be affected by multiple checkbox controls.

    How can I affect the position of a Null based on multiple Checkbox Controls?

    if (thisComp.layer("Total Diamonds").effect("8")("Checkbox") ==1) [799.4,70.0] else [741.7,70.0];
    if (thisComp.layer("Total Diamonds").effect("7")("Checkbox") ==1) [856.7,70.0] else [741.7,70.0];
    if (thisComp.layer("Total Diamonds").effect("6")("Checkbox") ==1) [914.5,70.0] else [741.7,70.0];
    if (thisComp.layer("Total Diamonds").effect("5")("Checkbox") ==1) [972.0,70.0] else [741.7,70.0];
    if (thisComp.layer("Total Diamonds").effect("4")("Checkbox") ==1) [1029.7,70.0] else [741.7,70.0];
    if (thisComp.layer("Total Diamonds").effect("3")("Checkbox") ==1) [1087.2,70.0] else [741.7,70.0];

    Dan Ebberts replied 7 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    June 6, 2018 at 12:10 am

    I think it would look more like this:

    L = thisComp.layer(“Total Diamonds”);
    if (L.effect(“8”)(“Checkbox”) ==1) [799.4,70.0]
    else if (L.effect(“7”)(“Checkbox”) ==1) [856.7,70.0]
    else if (L.effect(“6”)(“Checkbox”) ==1) [914.5,70.0]
    else if (L.effect(“5”)(“Checkbox”) ==1) [972.0,70.0]
    else if (L.effect(“4”)(“Checkbox”) ==1) [1029.7,70.0]
    else if (L.effect(“3”)(“Checkbox”) ==1) [1087.2,70.0]
    else [741.7,70.0];

    Dan

  • Angel Alcantara

    June 7, 2018 at 2:00 pm

    This works like magic! Dan, thank you so much!

    For learning purposes, what is this expression saying? Is it something along the lines of “only if ONE checkbox is on at a time.”?

  • Angel Alcantara

    June 7, 2018 at 2:02 pm

    This works like magic! Dan, thank you so much!

    For learning purposes, what is this expression saying? Is it something along the lines of “only if ONE checkbox is on at a time.”?

  • Dan Ebberts

    June 7, 2018 at 5:08 pm

    Starting with the highest numbered checkbox, it stops as soon as it finds one that’s checked (or accepts the default if nonoe are checked). So the highest numbered checked checkbox wins.

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