Week 2 sufferings

Inspiration that is way out of my league

I am fascinated by the fact that these organic snake is actually a code and not a hand drawn artwork. Overall, the idea of making or attempting to make organic shapes from loops sounds very appealing to me!

I was doing my ellipse loop with the help of “for” function from Processing.org site. I was trying to figure out what each thingy in a bracket meant and manipulated them accordingly. I managed to get a very beautiful loop of circles all the way down to the screen and wanted to make them turn so its similar to a snake. So, I decided to try rotate function. I added it to the code and the image below happened.

I lowkey considered leaving it like this, because it looked pretty :D, but then reality hit me and I had to do some other stuff.

And after these painful screenshots of doing everything and at the same time nothing:

Aruzhan Temirgaliyeva Week 2 Intro to IM  –  press here to see the painful three screenshots I managed to make while suffering on this awful abomination that I cant even call a code. No, this is on the same level as omg why do I have such a poor time management

I came to this final product:

  1. I decided to create a clock since I couldn’t figure out how to make an angular transition of a loop to resemble that  snakes movement and bending;
  2. I created 4 lines of ellipse loops using “for” and “noise” function;
  3. I played around with coordinates to make them align properly;
  4. I found Youtube video on how rotation and angles were made and decided to try it, since there still was a lot of hope I had for making a snaky bending thingy (foolish me);
  5. I tried the code, however couldn’t incorporate it with ellipses and make two separate loops connect.
  6. So I just lost hours understanding that the coordination system is like a paper. How, when you translate you change the coordinates not of the shape but of the grid and the paper itself. How popMatrix saves the coordinates and push returns them to their original state and so on.
  7. Then I just added as far as I could understand the lines and another ellipse to the center of the clock in order to finish of the whole image.
  8. And using lerpColour added gradient between 2 colours so it looked pretty!
//the coordination system is like a piece of paper
//VELOCITY = change in position over time
// ACCELERATION = change in velocity over time
// angle is an angular position, not a vector, single number
float b = 0;
float s = 0;
float a = 0.0; // a is some angle
float aVelocity = 0.0; // angular velocity's some amount
float aAcceleration = 1;
int fromC;
int toC;
int interA;
int interB;

void setup() {
  size(1100, 700);
} 

void draw() {
  background(255);
  stroke(1);
  fromC = color(255,200,200);
  toC = color(230, 0, 0);
  interA = lerpColor(fromC, toC, 0.33);
  interB = lerpColor(fromC, toC, 0.66);

  //ellipse width down
  for (int i=0; i<width; i+=1) {
    s = s + 1;
    float x = noise(s);
    x = map(x, 0, 1, 0, 1100);
    fill(fromC);
    ellipse (x, 600, 50, 50);
  }
  //ellipse height right
  for (int i=0; i<width; i+=1) {
    b = b + 1;
    float x = noise(b);
    x = map(x, 0, 1, 0, -685);
    rotate(PI/2);
    fill(fromC);
    ellipse (x, 1000, 50, 50);
  }
  //ellipse height left
  for (int i=0; i<width; i+=1) {
    b = b + 1;
    float x = noise(b);
    x = map(x, 0, 1, 0, -685);
    rotate(PI/2);
    fill(interA);
    ellipse (x, 50, 50, 50);
  }

  //ellipse width up
  for (int i=0; i<width; i+=1) {
    s = s + 1;
    float x = noise(s);
    x = map(x, 0, 1, 0, 1100);
    fill(interB);
    ellipse (x, 50, 50, 50);
  }
  //god bless the coding train guys
  aAcceleration = map(mouseX, -0, width, -0.001, 0.001);
  a+= aVelocity; //velocity changes its position
  aVelocity += aAcceleration; // velocity changes acceleration
  translate(500, 350);
  rotate (a);
  line(0, 0, 100, 200);
  translate(100, 100);
  fill(toC);
  ellipse(-100, -100, 100, 100);
}
Conclusions and lessons to be drawn:
  • If you think you can do it, you cant;
  • If you have a couple hours to do a week’s work, shame on you and no chocolate for you, life is bitter when you have poor time management;
  • Computer rooms are cold;
  • God bless guys from YouTube channel “The Coding Train” and professing.org;
  • My work fits the meme about”Expectations VS. Reality” :’)
Reference list:
  • https://py.processing.org/reference/lerpColor.html
  • https://www.youtube.com/watch?v=8ZEMLCnn8v0&list=PLRqwX-V7Uu6bgPNQAdxQZpJuJCjeOr7VD&index=8
  • https://www.youtube.com/watch?v=YcdldZ1E9gU&list=PLRqwX-V7Uu6bgPNQAdxQZpJuJCjeOr7VD&index=2
  • https://www.youtube.com/watch?v=qMq-zd6hguc

One thought on “Week 2 sufferings”

  1. You can totally do it Aruzhan! If you think you can you can! Let me know when you need help and we can get you figuring out how to do the things you want to do.

Leave a Reply