Does anyone know of a way to limit the length of an animated line to a specific value (eg. 300px)?
The line/path has three points/handles (start, middle and end).
I'm wondering if there is an expression that could do this while allowing me to still animate with the handles.
Is it possible? Yes. Is it easy? Not by any stretch of the imagination. You would have to essentially re-create the entire Bèzier formula in expression code and calculate its inverse to constrain the length and have loops running upon loops to continually check and recalculate the values. Performance would be far from great. It's basically that old gag why spline deformers in 3D programs also drastically slow down when set to retain fixed lengths vs. their normal modes. Performance can really go down the drain so whatever you have in mind will liekly require a different approach.
Ah, ok thanks. That sounds far to complex for this situation.
I was expecting there to be something simple like 'length = x'.
I'll find another approach. Thanks for the reply.
There's a very handy script called "Create Nulls from Paths" You can find it at the bottom of the Window menu.
Draw a mask on a solid to have 3 points. Then in the timeline, select the path. Go to Window > Create Paths from Nulls and choose the Points follow Nulls option in the pop-up. This will create 3 null objects, which you can control the position of in the usual way.
I was actually planning to use the 'Nulls follow points' to attach things to my line once I had finished animating it.
A solution from our friends over on Reddit;
Convert the line to a dashed line. Increase the dash/gap size until it looks line a single line again. Adjust the offset (if necessary). Aimate the path and the line wont resize.
Interesting trick! Thanks for sharing!