ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Angel Alcantara
How can I affect the position of a Null based on multiple Checkbox Controls?
on Jun 5, 2018 at 10:10:59 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];


Return to posts index

Dan Ebberts
Re: How can I affect the position of a Null based on multiple Checkbox Controls?
on Jun 6, 2018 at 12:10:46 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



Return to posts index

Angel Alcantara
Re: How can I affect the position of a Null based on multiple Checkbox Controls?
on Jun 7, 2018 at 2:00:36 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."?


Return to posts index


Angel Alcantara
Re: How can I affect the position of a Null based on multiple Checkbox Controls?
on Jun 7, 2018 at 2:02:46 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."?


Return to posts index

Dan Ebberts
Re: How can I affect the position of a Null based on multiple Checkbox Controls?
on Jun 7, 2018 at 5:08:59 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.



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]