I want to trigger an animation when two layers overlap using For-Loop
Hi guys, I'm a novice when it comes to expressions.
So what I want to do is trigger an animation on the Opacity setting going from let's say 25% to 75% taking .5 seconds, when one layer overlaps another. Right now I've got the overlap working but it snaps from 25% to 75%. And I'm guessing I'd have to use a for loop statement for this. I don't think just a linear() statment will work. I tried looking up for loops online but I mostly get the loopOut statments. Any help would be appreciated. Right now my code looks like this and I'm using sliders to adjust the opacity, duration and layer selection of the overlap.
var lyr = effect("Collision Controls")("Select Collision Layer");
var lyrCol = lyr.transform.position;
var nA = effect("Collision Controls")("Collide ON");
var nB = effect("Collision Controls")("Collide OFF");
var dur = effect("Collision Controls")("Duration")
var Alpha = thisLayer.sampleImage(lyrCol, [1,1]) [3];
if (Alpha < 1){ nB }else{ nA }
Thanks!
