Skip to main content
Inspiring
May 18, 2021
Answered

Set an exact length for an animated line/path.

  • May 18, 2021
  • 4 replies
  • 1961 views

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.

 

Thanks. 

This topic has been closed for replies.
Correct answer Daniel_87

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. 

 

4 replies

Mylenium
Legend
May 18, 2021

Interesting trick! Thanks for sharing!

 

Mylenium

Daniel_87AuthorCorrect answer
Inspiring
May 18, 2021

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. 

 

ShiveringCactus
Community Expert
Community Expert
May 18, 2021

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.

Daniel_87Author
Inspiring
May 18, 2021

I was actually planning to use the 'Nulls follow points' to attach things to my line once I had finished animating it.

Mylenium
Legend
May 18, 2021

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.

 

Mylenium

Daniel_87Author
Inspiring
May 18, 2021

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.