Coding Assignment Week #4 – Hypnosis

INSPIRATION & CONCEPT

My inspiration for this week’s assignment was the artist we looked at in class last week – Memo Akten. His work, The Awesome Machinery of Nature, was quite fascinating. I wanted to create a similar effect to that with circles coming out of a circle and colliding and creating a ripple effect. Since the motion was periodic (with some variation) I thought of modelling it with functions of sin and cosine for this week’s SHM project. Let’s see how that went.

MY PROCESS

I started with first trying to align all dots in a circles and alter their individual movements by changing their radius in a periodic motion modelled by sin and cosine. There are the first few attempts looked like this:

By playing around with the period, phase difference, and timeOffset parameters, I saw interesting patterns:

Half a wave with so much as corners:

2 breathing circle and semicircle patterns with only one wave! Not two!!

In the above one, It looks like the semicircles are in a relay race, passing the baton.

Playing around with the parameters of this, I got something more interesting:

More intricate:

Yes, I kind of branched out way too much here and lost focus of what I started with. But before I redirected my focus into creating something similar to Memo Akten’s work, I wanted to try one more thing. Trying to create a standing wave. What we practiced in class, looked like a sin wave going sideways, I did not want that, but rather the particles to oscillate in the same place – I kind of said the same thing didn’t I? Yes, but visually it looks different. For example:

Here is a bouncing sin wave appearing to move towards the left:

But now, below is the same sin wave but bouncing in its position (notice the leftmost point does not move / stays in its place – called a node in physics):

Now combining all of this, I set out to create an SHM hypnosis like artwork for this week’s coding assignment. Below are the various iterations and versions of it:

By playing around with the wavelength and phase difference, I got this illusion of the full disk/plate moving.

By employing prime numbers like 23, 41, 43 (in order for below sketches), I got this breathing kind of illusion – but fragmented, instead of a full circle.

By adding multiple sin waves (superposition of waves), I was able to make this amoeba style effect.

TECHNICAL DESIGN AND CODE

So the main piece of code that influences all of this is the following:

let y1 = (map(sin(angle+phaseDiff*i*wave2_offeset), -1, 1, radius-50, radius+50));
let y2 = (map(sin(angle+phaseDiff*i*wave2_offeset), -1, 1, radius-50, radius+50));

let y = (y1 + y2)/2; // to not have the amplitude v high - scaling it down
    
let x = map(i, 0, num, 0, TWO_PI);
    
stroke(255);
line(0, 0, y*cos(x*offset), y*sin(x*offset)); // draw the circles in circlular fashion instead of linear
    
fill(red, g, b);
circle(x*offset, y, radius*2); // draw the actual circles
    
let r = map(sin(angle+phaseDiff*i), -1, 1, 5, 15); // radius of outer circle varies slightly each loop -> to create breathing effect

// update angle

I have 2 sin waves superimposed which gives this jelly-like effect of the moving circles (in contrast to the first example which was achieved solely by one sin wave). Then the key is the wave_offset and the particle offset which create the phase difference and the periodic motion between the particles. changing the position of the offset in the equation also changes the appearance from bring a standing wave to a moving wave.

The various parameters used above are initialised are such:

let offset = 4; // try n = 21, 23, 41, 43, 27, 10, 2, 1
let angle = 0;
let num, period, phaseDiff;
let radius = 100, t= 0;
let wave2_offeset;

function setup() {
  createCanvas(400, 400);
  num = width/offset;
  // radius = offset/2;
  period = num/2;
  phaseDiff = TWO_PI/period;
  wave2_offeset = PI; // try option PI/2, 2, 5 etc.
}

By playing around with the above parameter values, we get varied results as shown above.

FURTHER DEVELOPMENTS

I believe this design and idea has a lot of potential. I could make a couple of such circles to look like fireworks. Or develop it sequentially to do tasks one after the other. Or make it oscillate based on sound. Many aesthetic and conceptual things might be achieve with this preliminary idea.

Leave a Reply

Your email address will not be published. Required fields are marked *