FORUMS: list search recent posts

recalling an if else statement?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Brad Pickford
recalling an if else statement?
on Jan 10, 2012 at 1:40:54 pm

Hi,
I was looking to see if this is possible with an if else statement...

I have a pretty complicated character rig setup. What I want to do is have an expression slider setup to move the position of the legs so that when the slider is moved into the positive numbers the legs will move to the centre of the body and when the slider is moved into the negative numbers the legs also move into the centre of the body. So what is happening is this, at 0 the legs are at their furthest apart, the character is facing forwards. When I move the slider in the positive direction the legs move closer together giving the illusion that the body is turning. The reason I want the legs to also move into the centre of the body when the slider is moving in the negative direction is because I am using a opacity trick that will turn layers on and off depending if the slider is in the positive or negative. This way one leg will be in front of the body and the other will be behind giving the illusion that the character is turning around. Sorry if it is a bit hard to understand. This is what I was thinking but it is not working...

n = thisComp.layer("Controllers").effect("Body Turn")("Slider");
j = if (n>0) -1 else 1;
[value[0] + j , value[1]]

Does anyone have a better idea? I have looked around the net and stumbled upon functions but are not too sure how to use them?

Cheers,
Brad


Return to posts index

Kevin Camp
Re: recalling an if else statement?
on Jan 10, 2012 at 8:40:17 pm

i'm not sure i completely follow what you are doing, but looking at your statement i think you just need it to look something like this:

n = thisComp.layer("Controllers").effect("Body Turn")("Slider");
if (n>0) j = -1 else j = 1;
value + [j,0]

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

Brad Pickford
Re: recalling an if else statement?
on Jan 10, 2012 at 9:50:14 pm

Thanks so much for your reply Kevin. It was great to see how to get a variable out of an if statement. To make it work for my situation I just changed it to the following....

n = thisComp.layer("Controllers").effect("Body Turn")("Slider");
if (n >= 0) j = 1 else j = -1;
m= n*j;
[value [0]+m, value[1]]

Works perfectly, Thanks Kevin!


Return to posts index

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