Processing Tutorial – Creating Conditionals (Part 2)

So after attempting to digest all that I learnt during the first part of that tutorial, I decided today to jump right back in to where I reached a few days ago.

Jade Lauran DesignThe first part of this section got me creating ‘switch statements’, which is the term given when you have more that one possible choice. In the case of this tutorial, 4. Creating a new block of code, for ‘keyPressed’, I created the section which would allow the colour of the ellipse change to a random variable in the colour pallet. I also created another for the choice variable based on which key is pressed. The next stage was to create a ‘switch block’ in a nested code block. Depending on the value that is chosen, the switch would be triggered by the choice (‘1’, ‘2’, ‘3’, ‘4’, or ‘5’) using ASCII code.

This section of the code was slightly tricky to follow as at the start, the decimals had to be turned into integers (between 1 and 5), and at times I just had to just push through with the code even though I wasn’t 100% sure what I would of had to do if I was doing this un-aided by a tutorial.

And this is, below, what I finished with:

Jade Lauran Design Jade Lauran Design Jade Lauran Design
Jade Lauran Design

 

This tutorial was probably a bit ambitious based on my previous processing knowledge but I am glad that I didn’t give up and stuck it out till the end but in terms of my interacting installation I will probably keep it much simpler to avoid over complicating things. This tutorial did however show me that there is lots of ways to control code using a variation of conditional statements.

References:

– Poulson, B. Interactive Data Visualisation with Processing: Creating Conditionals. Available at: http://www.lynda.com/Processing-tutorials/Creating-conditionals/97578/113186-4.html [Accessed On: 3 November 2014].

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s