AE Expression for "Previous Frame"?
Hi all,
Got a quick one today: is there an AE script term that tells it "previous frame"? Literally all I'm trying to do is compare Y position values between the current frame and the previous one. I've come up with a way to do it, but I want to know if there's a better/proper way to go about it. Here's my solution:
temp1 = 1 //number of frames to count backward;
temp2 = framesToTime(temp1, fps=1.0/thisComp.frameDuration)
transform.yPosition.valueAtTime(time - temp2)The way I did it is a tad clumsy, but what I basically did was to calculate the duration of one frame relative to the frame rate of the comp, and then subtract that amount from the current time.
It feels like this is more elaborate than it needs to be, but this is the best way I could think of (or find while Googling) to do what I was trying to do.
(If you're wondering what this is doing it's going into a scroll bar setup I've developed that will light up an "up" arrow if the previous frame's Y value is more than the current one, and a "down" arrow if it's more; a variant is going to light up the scroll bar itself.)
