Scale shape over time based on position
I'm totally new to expressions and have spent a couple of hours trying to figure this out. Thanks in advance for your assistance.
I have a shape layer (an ellipse). It is meant to represent where a person's eyes are looking on the screen (like in this video: https://youtu.be/TwNNij89qro). The position of the ellipse changes based on when the eyes move from point to point. I have set all the position keyframes manually. I'd like the scale of the ellipse to change based on how long it remains fixed in one location. The longer it remains in one spot, the larger it gets. A 10% increase per frame seems to work well. So, if the ellipse remains in one place for ten frames, it will increase in size to 200%. If it's just five frames, the ellipse grows to 150%. When it moves to a new location, the scale should reset to 100%.
Here's my newbie expression (feel free to laugh). This expression has been placed on the Scale property for the ellipse. Parts of this seem to work on their own, but it's not doing what I would like it to do as a whole:
var prevFrame = position.valueAtTime(time - .0333)
var currentFrame = position.valueAtTime(time);
if (currentFrame = prevFrame) transform.scale +[10, 10];
else [100, 100];
As you'll see, I tried to look at the position of the previous frame, then compare it's position to the current frame. I've calculated one frame to be .033 seconds. The ellipse scales up to 110% but that's it. It starts at 110% and stays that size for all frames. The expression doesn't generate an error, so I'm thinking I might be close. But I'm also guessing there are ten other ways to do this that might be better.
Thanks for looking this over and offering your guidance.