Week #4 Coding Assignment – Oscillation

(I couldn’t post this on time because I couldn’t log in to WordPress, thanks for understanding).

https://editor.p5js.org/oae233/sketches/dF00ekRNz

Concept / Idea

So for my original concept, I wanted to draw a circle with the beginShape() function, which I knew how to do, but then I wanted each point on the circle to oscillate between being at the center of the circle and being at the edge, and I wanted each point to be on a different phase/period. I also planned to introduce some random movement to the vertex separately so that the shape can transform and morph.

What I ended up with is basically a collection of semi-failed attempts at what i just described. Every time I would encounter something I found visually interesting, I’d play around with it until I was satisfied with it, then give the original plan another go.

Ultimately I wasn’t able to achieve what I wanted but I ended up with something that I felt was quite rewarding, a record of the process that continuously created appealing visuals.

Some Code:

beginShape();

  for (let x = 0; x <= TWO_PI; x += PI / 30) {

    vertex(R * cos(x), R * sin(x));

  }

  endShape();

 

This is the base code for every shape in my sketch. This code draws a circle with the radius of “R”. Using the “t” variable in a sine/cosine function [eg: sin(t/50], I am able to vary different attributes of the circle.

Future work:

For the future of this project, I’d like to add to a successful implementation of my original idea of the morphing shape. I also think it would be great to make a class out of the code block above, and just feed different values to different instances of that class to create all the varying shapes.

Leave a Reply

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