Grid Element Position to
I'm new to expressions and not sure how to achieve the following:
I have a grid of small circles (shape layers) with 20 columns and 11 rows. In the animation, I want one circle in the grid ("leader") to be the target position for all the other elements of the grid: the animation would start as a grid and end in one circle. Every circle would have a keyframed starting position and an get the end position from the "leader", probably through an expression or a keyframe.
If all the grid elements just use the leaders end position keyframe, it's doing not quite the effect I want. The further the circles are away from the leader, the faster they move, since the end keyframe is always the same.
- How can I achieve some kind of "speed limit" for the circles? The further they are away, the longer they should need to reach the end position. Is there an expression I can apply to the position change (and without losing easing)?
Any help or links to tutorials would be appreciated!
- Is there a way to let an element change it's position from a given keyframe to the leaders position without a second keyframe? Like an attractor-expression?
Might not be that easy if you're new to expressions, but the basic idea would be this, no keyframes needed (necessarily).
"Time" is variable that changes, and it changes at an even pace. The other variable that applies to how fast the objects should move is their original distance from the end point. So you would want to remap time into position, taking into account how far the object originally is.
One of the key things is my favorite expression linear() or ease(), which remaps one thing to another with or without easing. Take linear for sake of simplicity. You would remap time to position between origin and target. This might be easier to approach as a percentage of position between origin and target. Thus, using descriptive variable names:
linear(time, starttime, starttime+distance, 0, 100)
Where 0 and 100 are the origin point and target point respectively. In other words, the percentage of target point in the calculation is 0 at the beginning and 100 at the end.
Follow so far?
You could, of course just use the origin point and target point, but those are two-dimensional arrays rather than variables, so this is a sightly easier method in that aspect.
To make an expression out of this, you would have define "starttime", and calculate "distance" from origin to target.
You would get the percentage as a result, and then it would be a matter of calculating the current position with that percentage.
Senior Graphic Designer
Thank you very much for this detailed answer! I have to admit I didn't expect it would be so complicated, this is a bit over my head.
With the right keywords ("constant speed" instead of "max speed") I've found and older thread with a similar problem. With the help of a slider control and roving keyframes, the script creates a constant speed. I changed "linear" to "ease" and I believe it now does what I want.