Loops & Conditionals

For this assignment, I created a rudimentary game and interactive art sketch to demonstrate my knowledge of loops and conditionals.

Circle Loops

  • Used mouseX, mouseY, sin and cos to create a for loop that changes the circumference of circles as you move the mouse around.
  • Used an if statement for loop to create a gradient that changes the opacity and color of the circles in the design as you hold and cross the mouse over the middle of the canvas.

Ball Game

  • Used for loops to make a ball bounce around the inside of the screen.
  • Used mouseIsPressed() to trigger the change in color and increase in speed of the ball when you click on the center.

--

--