Assignment #2 – The Inescapable Prison

Doing this assignment, I did not have something in mind and I just wanted to explore and play around with creations I could make. Eventually, I ended up using a loop to make lines, which formed a rather interesting shape. I decided to go with that, but I did not want to submit a random creation of complex lines, so I started exploring what I could do to make something out of these lines. After experimenting with movement, I decided to go with an inescapable prison where the harder the person tries to escape, the faster the movement gets.

 

This is my very first time experimenting with an interactive element. It was very simple to apply. However, I am very proud of myself for adding that element.

I am proud of everything on the canvas. I did have to search up how I could have the background change colors and that took a whilr to figure out. While this creation is not perfect, I still deeply love it.

//   Lines
  for (let x = 0; x <= width; x += 50) {
    for (let y = 0; y <= height; y += 50) {
      line(lineX, y, x, lineY);
    }
  }
  //Speed up when mouse is pressed
  if (mouseIsPressed) {
    lineSpeedX = lineSpeedX + 1;
    lineSpeedY = lineSpeedY + 1;
  }
  // Move the lines horizontally and vertically
  lineX += lineSpeedX;
  lineY += lineSpeedY;

  // Reverse direction when hitting the canvas edges and change colors
  if (lineX > width || lineX < 0) {
    lineSpeedX *= -1;
    stroke(random(255), random(255), random(255));
  }
  if (lineY > height || lineY < 0) {
    lineSpeedY *= -1;
    stroke(random(255), random(255), random(255));
  }
}

Reflection:

I had so much fun playing around with code and discovering new ways to implement interaction with creations. I am excited to delve deeper and to find out what this course has in store for me.

Leave a Reply