Computational Thinking

Joel Gethin Lewis

Lecture 5

What I'm going to talk about today:

  1. Randomisation.
  2. Updating your status and getting jobs done.
  3. Classes and Objects in JavaScript.
  4. Introduction to p5.js libraries.

Randomisation.

Thanks again to Rune Madsen for putting his course online:

http://printingcode.runemadsen.com/lecture-randomization/

Don't forget to click to the slides and press 's' Joel!

Randomisation.

You may have noticed that all of Rune Madsen's code is written in Rune.js rather than p5.js.

We picked Rune's tutorials as they had an excellent grounding in the history of Graphic Design.

There are lots of JavaScript libraries out there and we chose p5.js because of its community - especially the amount of tutorials that are out there and especially the ones from Dan Shiffman, who we've met before.

Randomisation.

I particularly like his videos on YouTube, aka the Coding Train.

There are a whole series of great p5.js tutorials which I'd recommend.

Ooo a Perlin Noise series! I'd really recommend getting used to reading around the subject in general - it's the best way to learn. Also don't be afraid to type the thing you are looking for into Google with p5.js added too.

Updating your status and getting jobs done.

Thanks again to Ali Almossawi for writing his book.

Read the Updating your status and getting jobs done chapters of "Bad Choices" Joel!

Classes and Objects in JavaScript.

A Class is just a way of storing both variables and functions in one place - instead of having loads of variables and functions everywhere you can put them all into a Class - from there you can make multiple instances of a Class - Objects. Functions that are inside Classes are called Methods.

Object Orientated Programming is a whole programming paradigm or way of coding.

Classes and Objects in JavaScript.

The following content is all from the JavaScript Basics section of the p5.js wiki.

Classes and Objects in JavaScript. Don't forget to try it all out using the JavaScript console!

Introduction to p5.js libraries.

A library is just a set of useful Classes that help you do something.

The p5.js team maintains a list of libraries that work with p5.js:
https://p5js.org/libraries/

Let's try speech! Or make an interface!

Not only that but you can add ANY JavaScript library to p5.js, but sometimes it can be a bit complicated.

Thanks!