Geometry Nodes: Round caps on 2D profile curve / Round caps on 2D stroke

I am trying to reproduce a simple After Effects effect with geometry nodes by using 2D geometry.
I have a curve and like to give it a kind of 2D stroke (meaning: not a pipe) and be able to trim the stroke’s start or end points by a factor (like After Effects’ trim path effect). Using geometry nodes I could easily apply the effect to any future curve by appending this GN node tree.
Working with 2D geometry is crucial in my case (I am working with an orthographic camera), to avoid unneeded geometry and keep perfomance in heavier scenes.

Yet I’ve build this node tree, which lets me trim the curve well, but I am struggeling to get nice round start- and endpoints on the curve.
When using a curve circle node as profile curve I get holes in the mesh when the circle is overlapping itself at the beginning of the curve. Unwanted!
When using a curve arc node as profile curve (like in the screenshot) I get a unwanted concave beginning of the curve, but I need to have it round.

Any ideas how to get round 2D “stroke” start and endpoints in this scenario?

I’m sure there must be a more elegant way to do it but I’d start with a 3d pipe, instance a sphere on both ends to have the rounded endpoints and then flatten it at the end and delete unnecessary geo.


CurveLine_1.blend (1001.1 KB)

1 Like

Good idea, thank you. I’ve took your idea one step further to avoid the workaround of adding 3D and flatening it down again. I went with my 2D curve arc solution: I just instanced a filled circle curve to the beginning of the curve and it seems to work. Although we have a geometry of two meshes they seem to blend up well in the viewport and the render. I admit, not very elegant, but it kind of gets the job done.
If anyone has a more elegant way to do it, feel free to share.

PS: For future readers. I just learned about the ability to instance objects on curve start/endpoints by stumbeling across this tutorial.

1 Like

Here is a method that uses float curve and works with 3d curves also (as a flat effect):

Good luck.

5 Likes

Nicely made and way more elegant. Thank you for sharing!

PS: I have to admit, that this setup is beyond my GN skills. I couldn’t have come up with this. E.g. I can’t follow why the ‘Switch’ and ‘Or’ nodes are used and necessary. But thats fine and I don’t mind using the more easy Frankenstein-method from above.