## processing phaseflower

Since I haven't used Processing in a while, I dusted of my processing installation (and upgraded it to the latest version) and started to make some animations. I wanted to create an animation that morphes between random states of a parameterset over a random time periode, then stay at that state for some time and repeat ad infinitum. I implemented a similar state morphing system for a fractal in ronin a while ago and wanted to port it to processing. what could go wrong - right?

The base sketch I wanted to morph was a flower like shape that uses polar coordinates to modulate the radius of a bunch of small circles that are placed in a circle. Each target state that is held for some time should be a whole number multiple of the radius so that the modulations fit on a circle wihout jumps.

I implemented the drawing function and a first very simple state morphing system that is a direct port from my ronin sketch. There I simply interpolate between two states of a parameter over a given time

p = p1 + currenttime(p2 - p1)/periode

well that worked ok for the fractal curves i used id for in my last sketch, but since I used it here to do some modulations on a circular shape using polar coordinates the shape started to look really ugly when my parameter had some inbetween states that results in a fractual number. Hrmpf.

so back to the drawing board. Directly morphing the parameters and then calculating the position of the circles didn't work as expected.

After some experimenting I ended up at linear interpolation of the resulting circle positions that are calculated from the parametersets instead of morphing the paramters themslef. This way i can always use whole numbers as start and end values for a transition and no inbetween states that result in hard jumps are generated

lessions learned: simply morphing between states by blending parameters is fine in cartesian space - but results in wired transitions when polar coordinates or rotations are involved.

If you want to experiment with my state changing phase flower you can run it here.

click here to start the sketch or download the sourcecode.

read more ...