# Animation Nodes - How to create transition with the gif-animated squares

This is my square with gif animation. You can right-click on animation and press Save Image. It will save as gif.

I wish to repeat the animated squares to create examples below. How do I do that with Animation Nodes? I'm not too fussy how you do it, as long as I'm learning Animation Nodes. Thanks in advance.

Example #1

Example #2

Example #3

• Do you want to create the animation itself in AN? Or do you want to instance planes with the animation as a texture? – Omar Emara Nov 29 '18 at 21:16
• Whichever is the easiest for you. I like to see what you can do instance planes. I have never tried that before. . – Rita Geraghty stands by Monica Nov 29 '18 at 23:25

We shall create the animation by morphing between those shapes sequentially. The first shape is a four-petal flower shape, this can be created by modulating the the amplitude of a circle based on a positive sine wave. First, we create a circle using its parametric equation:

Then the circle is scaled based on the absolute of a sine wave. The integral multiple of the parameter range controls the frequency of wave which controls the number of petals. A phase shift is introduced by adding some scalar to the parameter, this effectively rotates the flower. Moreover, the power of the wave controles its curvature and a scalar addition to the wave controls the radius of the center part:

The next shape is a squircle that turns into a superellipse (A squircle is a special case of a superellipse), so lets create a superellipse. The superellipse is just a circle that was powered retaining its sign:

Finally, it turns into a square, which is the limit of the superellipse as the power approaches zero. So, lets animate between all those shapes. We start with the petal shape (Which is a superellipse with a unity power) that have a zero radius and animate the radius to reach the required state, we are also going to animate the phase shift to rotate the petal at some point:

Then, we are going to animate to a squircle with a constant radius. This is done by animating the petal factors to a constant radius and the power of the superellipse to half:

Then, we animate to a high power:

Finally, we animate to a square, remember that a square is the superellipse as its power approaches zero:

Finally, we create a mesh from those vertices:

To create a grid of those objects, create a loop with a time offset:

Adjust the timing, durations, offsets, and other parameters to get the result you are looking for.

• Omar, this is amazing. Wow, you did lot of work there. They are truly great! Many thanks. – Rita Geraghty stands by Monica Dec 1 '18 at 11:40
• Such complete and concise answer deserves an X2 bounty bonus x) – L0Lock Dec 10 '18 at 14:35
• L0Lock, you should see his answers to my previous questions and to others' questions. He contributes A LOT to Blender Stackoverflow, my Animation Node scrapbook thus bulging, so a bounty of 50 is my token of gratitude. I have some of his works in this scrapbook link. docs.google.com/presentation/d/… – Rita Geraghty stands by Monica Dec 10 '18 at 15:21