Spiral unrolling/rolling animation in Animation Nodes?

I saw a topic on ordfoce.net on unrolling spirals and discrete paths as shown here: How can I replicate this in Animation Nodes?

It has the following steps:

1) First sample the base spline (which going to be folded) i.e sample points and divide the sample points into two lists L1 (length_Max - length_L2) and L2 (length_L2).

2) Get the last point of L1 and use this point to transfer the folded shape (circle or spiral)

3) Then map the L2 points to folded shape (circle or spiral which can have any number of points) and then store the mapped points in the new list L.

4) Combine the list L and L1 i.e (L + L1) and use these points for the new spline.

5) By animating the length of the L1 and L2 lists, you can animate the folding spline or curve.

Step-1:

Sample the spline and divide the sample points using slice node, one with start (L1) and other with end (L2) option which is control by the integer input node (called it as Offset Index). The use of reverse node to start the folding from the end of the base spline. Step-2

Use the same Offset Index to get the last point point of L1 list and use Distribute Matrices node for folding shape (circle or spiral) with transform node which will allow us later to transfer this shape along the spline with the last point of the L1 list. Step-3

Then use the last point of L1 to transfer the shape along the spline. This will transfer the whole shape points (folding shape) at the last point. But to offset the shape (in this case circle) such that its circumference touch the spline, use vector math node (ADD) and add the radius of the shape into z-axis (you can choose any direction) and adjust the rotation such that it align correct along z-axis.  Now, use base spline normal (last point as in L1 case) to align the folding shape on every point i.e you do dot need to align the shape manually, this automatic align the shape with respect to the the base spline normal when you change the Offset Index. Step-4 and Step-5

You have the transferred shape points and L2 points. Now mix them using the vector mix node in a loop with factor = 1. Then combine the mixed points with existing L1 points using vector combine list node and these are final points (yellow) which you can use to make new spline. One with shape as spiral • Awesome! Thank you for sharing! Apr 13 '19 at 2:23