Skip to main content
Participating Frequently
March 25, 2024
Answered

After effects Dropdown and slider expression to change position of a layer

  • March 25, 2024
  • 1 reply
  • 876 views

I am creating a setup in after effects where I want to change a position according to a slider and dropdown values. Using below expression for the same 

mDrop = comp("Character Builder").layer("Body Type").effect("Body Type")("Menu");
s = thisComp.layer("Turn Body & Head").effect("Turn Body")("Slider");
x = transform.position[0];
y = transform.position[1];
[x,y];
if (s == 0 && mDrop == 1) {[x,y]}
else if (s == 1 && mDrop == 1) {[x-110,y-11]}
else if (s == 2 && mDrop == 1) {[x-325,y]}
else if (s == 3 && mDrop == 1) {[x-526,y-94.5]}
else if (s == 4 && mDrop == 1) {[x-598.,y-106.1]}
else if (s == -4 && mDrop == 1) {[x-598.,y-106.1]}
else if (s == -3 && mDrop == 1) {[x-495,y-79]}
else if (s == -2 && mDrop == 1) {[x-299,y]}
else if (s == -1 && mDrop == 1) {[x-71,y-14]}
else if (s == 1 && mDrop == 2) {[x-41.5,y+62.5]}



There will be more dropdown values till 5 and I want to change the postion if mentioned slider and dropdown values matches

 

This topic has been closed for replies.
Correct answer Dan Ebberts

What are the current values of the menu and the slider?


Try adding this as the last line and see if it gets rid of the error:

else value

1 reply

Dan Ebberts
Community Expert
Community Expert
March 25, 2024

I'm guessing you have a question, correct? From your screen cap, it looks like your expression generates an error. What's the error message?

Participating Frequently
March 25, 2024

Yes sorry it was a question. Error says "Undefined value used in expression"

I am not good with expressions. Any help will be a life saver.