-
Revert value to zero once to comp edge
Hey all. I have a position expression which moves in a certain direction each frame as follows (thanks to Dan Ebberts).
spd = effect("Slider Control")("Slider");
angle = effect("Angle Control")("Angle");
d = spd*(time-inPoint);
r = degreesToRadians(angle);
x = d*Math.cos(r);
y = d*Math.sin(r);
value + [x,y]But I need the x and y values to reset to 0 once they reach a certain threshold (such as the comp width/height).
I tried adding
if(x>100) x=0;
which works but keeps the value of x at 0 for the remainder..Something really simple I suspect but not getting anywhere at the moment!