HW: 4 Loops and Conditionals

  • use mouseIsPressed to trigger something- I used the mouseIsPressed function to help me incorporate varying noises and colors. I was able to do this successfully by being able to click the canvas allowing the noise to stop/start and the same with the color changing.
  • use mouseX and mouseY to change a bool- I used this formula
  • make a gradient with a for loop- I was able to use a loop to help me with my desired colors for my background. I messed around with the numbers in my background to get the desired pastel colors.
  • make a ball bounce around inside the screen- I used the if function to help my ball bounce within the canvas. This function helped make sure the ball bounced within in my canvas and didn’t go off the edges.
  • use nested for loops to create complex designs- The mouseX and mouseY function helped me draw a cool complex design. By moving my mouse in different directions on the canvas my design changes. I really like this part of my design.




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Bliss of Using React — with React Fiber

“Learn once, write anywhere” vs “write once, run anywhere” and why I choose Nativescript over…

Get Amped about Amplify!

HashMap aka Dictionary aka …

ReactJS Interview Question — Basic and advanced

Enhance your frontend state management with view models

How to do a real time application with socket.io + node.js (with consign) + React

Angular NgRx Data custom selectors

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kensie Cruickshank

Kensie Cruickshank

More from Medium

How to use Metastem Bridge

The Many Facets of Creating Explosive Growth (for apps and websites)

Comparing myself with my three-weeks younger version

How to do legal transformation: Structure and Incentives