Page 1 of 1

if/else in conjunction with degrees rotation and opacity?

Posted: February 23rd, 2007, 10:37 am
by DdK
I'm having a problem trying to figure something out:
I have two half rings, one smaller and inside the other. Both have a notch in them. Both are attached to a slider control such that when adjusted, they both rotate (simultaneously) in opposite directions.
What I need to accomplish is: when the notches in the two rings line up and pass one another (as the rings rotate), a glowing light flashes on, and, over five or so frames, eases off. The rings will be rotating back and forth sporadically causing the light to be constantly flashing on and easing off.
I have no problem figuring out how to turn the light on, but easing it off over time is not so simple.
I'm hoping I made this clear enough.
Thanks for any help.

Posted: February 23rd, 2007, 2:33 pm
by DdK
So far, this is the code I've come up with:
Attached to the slider:

Code: Select all

s=(effect("Slider Control")(1))
if (s>360) s=(s-361)
if (s<-360) s=(s+360)
Attached to the Opacity of the solid (light):

Code: Select all

r=thisComp.layer("Slider Control").effect("Slider Control")("Slider")
t=(time/0.3)
v=(valueAtTime(1))
o=(easeOut(t,100,0))
if (r==0 || r==180 || r==-180) v
else o
Unfortunately, the ease out works the first time, but only once. After that, the light blinks on and off with no ease out.
As you can see, I'm a novice at best.

Posted: February 23rd, 2007, 11:49 pm
by Dan Ebberts
It's a little more complicated than that. The problem is that since expressions have no memory, as soon as you move off the condition where the notches line up, the expression doesn't know that they were ever lined up. So what you have to do is create a loop that goes back frame-by-frame from the current time until it finds the most recent time where the notches lined up, calculate how long ago that was, and use that value to drive out your easeOut().

Dan

hmmm

Posted: February 26th, 2007, 3:16 pm
by DdK
hmm, so maybe if I created a separate comp (with the 'light' layer) and have it''s opacity easing from 100 to 0%. Then have the rotation layer refer to it at the appropriate time. hmmm, I'm gonna have to do some brain-thinkin'...this may take a while...