-
If and And and Then!!
I’m sure you’ll appreciate that doing a search for ‘if’ ‘and’ and ‘then’ brings up pretty much every post so I’m starting a new post here. Apologies if this has been posted before!
I have 94 coloured circles arranged across a frame in a logo.
I’m trying to do a clever expression which flips the circles around around when an object (CHANGER) passes over them in an almost mexican-wave type effect.
I am having a fair amount of success but I also need each CIRCLE to stay at 0 degrees before it passes over and stop at 180 degrees once the CHANGER has passed.
I am ‘hiding’ them using that nice Dan Ebebrts expression that hides the layer if it’s not facing the camera and so I am revealing them through rotation.
I can ‘reveal’ them (by revolving to camera as the CHANGER passes over them) fine however I need them to stop revolving after the CHANGER has done it’s stuff and passed them as, at the moment they continue to revolve as the CHANGER is carrying on it’s transform to effect the other layers further along the composition
Ok, so I’m using an if/else command to say…
if CHANGER is before the object’s position THEN hide it (i.e. keep it flipped round away from camera)
…but how do I find that sweet spot after that which stops the expression once it’s passed a certain value. I feel I need an AND bit.
Or do I?
hmmm…
Any help would be appreciated and am more than happy to elaborate on the above it it’s too confusing (it’s confusing enough for me and I kNOW what’s going on!!)
many thanks
jim
// APPLIED TO MY CIRCLES'S x ROTATION;xn = thisComp.layer("CHANGER").transform.position[0];
yn = thisComp.layer("CHANGER").transform.position[1];if ((my_rot=(transform.position[0]-xn)) > 0){my_rot=181}else {my_rot=(180-(transform.position[0]-xn))};
transform.xRotation=my_rot
//APPLIED TO OPACITY (just fyi);
a = toWorldVec([0,0,1]);
b = thisComp.layer("Camera 1").position - toWorld(anchor_point);
c = dot(a,b)/length(b);
if (c > 0) 0 else 100