5
$\begingroup$

I'm animating trimming of Curves with Geo nodes. My setup looks something like this. I'm delaying the start of the animation for multiple curves. I don't know how to control the order in which the paths will be trimmed. I guess the "Trim paths" node trims these paths according to their Index number (in pink)? If so - can I rearrange this order?

I'd like the paths to be trimmed based on their X position. The ones most to the left should trim first, and the ones most to the right - last. How would you go about that?

Cheers

enter image description here

$\endgroup$

1 Answer 1

3
+50
$\begingroup$

I guess the "Trim paths" node trims these paths according to their Index number (in pink)?

Yes. If the paths/splines are part of a single curve object, then it is the order in which you created the splines.

If so - can I rearrange this order?

Not easily. One option is to separate the splines into their own curve objects (L and P combo) and then join them (CTRL+J) in the order you want.

I'd like the paths to be trimmed based on their X position. ... How would you go about that?

From Blender 4.1, you can use the Sort Elements node to sort the splines. The sorting weight can be either the start or the end point's X coordinate of each spline, which you get by sampling the splines with factor of 0.0 or 1.0, respectively. You can use different factor if it makes sense for your use case. In edit mode, you can switch direction of individual segments/splines to control the sorting and animation flow.

geometry node graph

blender file download

See the animation results for factors of 0.0 and 1.0 (only difference is the order of splines 2 and 6).

animation result for factor of 0.0

animation result for factor of 1.0

For better control over the splines order, it would be wise to separate the splines into their own objects and put them into a new collection. You can then use the Collection Info and Realize Instances nodes to work with the splines inside the geometry nodes. With the Separate Children flag, the node will sort the splines by their curve object's name, which you can easily control.

nodes for working with collection

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .