We will use P5.js for several reasons. When learning visual (interaction) design, there is always the difficult issue of what kind of platform/software to use. There is a wide spectrum ranging from off-the-shelf interaction prototyping software on the one side, and purely coding (e.g. HTML5 etc) on the other hand.

P5.js seems to be nicely in the middle. On the one hand, it is relatively easy to generate interesting visuals. On the other hand, it can be a good introduction about how things on the web are organized. But most importantly using P5.js is really what sketching is about: a creative ping-pong game between your mind and the world where many serendipitous events occur that will lead to (literally) unimaginable outcomes. Further advantages include:

  1. free
  2. great community of artists and designers
  3. access to a wide variety of javascript plugins including machine learning
  4. concrete result because you generate an HTML page

How to sketch

Below you will find instructions to learn how you can code using P5.js, but before that let me quickly highlight the various ways you could use P5.js, specifically for this VCD course.

Below you will find links to P5 video tutorials by the creative coding genius teacher Daniel Shiffman. Be aware that some older videos use a different coding interface, you should just do everything in the P5 online editor.

Besides watching videos, the best things to do are

Coding train resources

The best thing to do is go to p5.js tutorial playlist from The Coding Train and watch all videos in the 1-7: Foundations of Programming in Javascript. I’ve seen all of them, and they are super usefull and enjoyable.

Nevertheless, if you have too little time, you can watch fragments from the tutorials that I ‘cut’ (using youtube’s embedding options). In most cases, I skipped the (quite lucid) fragments of Daniel Shiffman explaining theory on the whiteboard.

P5 practical training document

We have a ‘living’ google document that contains some assignments and tips we use(d) during practical training.

Cut videos of P5 introduction on coding train:

1.2: p5.js Web Editor (Part 1, 0:00-5:04)

1.3: Shapes & Drawing (Part 1, 9:00 - 10:10)

1.3: Shapes & Drawing (Part 2, 17:00 - 19:45)

1.3: Shapes & Drawing (Part 3, 21:45 - end)

1.4 Color (Part 1, 3:20 - 5:45)

1.4 Color (Part 2, 8:30-15:30)

1.5: Errors & Console (Part 1, 0:00-4:10)

1.6: Code Comments (Part 1, 0:00-2:00)

2.1: Variables in p5.js (mouseX, mouseY) (Part 1, 4:20-8:24)

2.1: Variables in p5.js (mouseX, mouseY) (Part 2, 10:45-11:35)

2.2: Variables in p5.js (Make your own) (Part 1, 6:23-7:30)

2.2: Variables in p5.js (Make your own) (Part 2, 10:28-11:00)

2.3: JavaScript Objects (Part 1, 0:00-1:26)

2.3: JavaScript Objects (Part 2, 05:25-8:54)

2.4: The map() Function (Part 1, 03:10-3:53)

2.4: The map() Function (Part 2, 7:30-9:40)

2.5: The random() Function (Part 1, 9:00-11:00)

3.1: Introduction to Conditional Statements (Part 1, 6:27-8:00)

3.2: The Bouncing Ball (Part 1, 0:00-0:40)

3.2: The Bouncing Ball (Part 2, 4:40-6:30)

3.3: Else and Else if, AND and OR (Part 1, 2:10-3:10)

3.3: Else and Else if, AND and OR (Part 2, 5:37-8:52)

3.3: Else and Else if, AND and OR (Part 3, 13:05-14:00)

3.3: Else and Else if, AND and OR (Part 4, 15:00-16:20)

3.4: Boolean Variables (Part 1, 4:40-7:57)

3.4: Boolean Variables (Part 2, 9:48-14:40)

3.4: Boolean Variables (Part 3, 16:44-17:40)

4.1: while and for Loops (Part 1, 7:00-8:07)

4.1: while and for Loops (Part 2, 10:34-13:10)

4.2: Nested Loops (Part 1, 2:40-3:45)

4.2: Nested Loops (Part 2, 4:22-8:01)

5.1: Function Basics (Part 1, 4:45-6:28)

5.1: Function Basics (Part 2, 9:20-12:02)

5.2 Function Parameters and Arguments (Part 1, 6:50-9:30)

5.3: Functions and Return (Part 1, 4:20-6:18)

5.4: Functions Inside of Objects (Part 1, COMPLETE!)