if/else in conjunction with degrees rotation and opacity?

Moderators: Disciple, zlovatt

Post Reply
DdK
Posts: 3
Joined: February 22nd, 2007, 6:44 pm
Contact:

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.
Last edited by DdK on February 23rd, 2007, 4:13 pm, edited 1 time in total.
DdK
Posts: 3
Joined: February 22nd, 2007, 6:44 pm
Contact:

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.
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

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
DdK
Posts: 3
Joined: February 22nd, 2007, 6:44 pm
Contact:

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...
Post Reply