When the course transformed from Visual Communication Design to When Images Remain, we had to make some tough decisions, one of which was to exclude learning to sketch in p5.js a mandatory learning objective. Nevertheless, we keep this page up to make use of it in other courses and perhaps still a little bit in When Images Remain ;).
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:
- free
- great community of artists and designers
- access to a wide variety of javascript plugins including machine learning
- 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.
- Besides using simple graphical elements, you can also use pictures of fragments of pictures as elements. Cut something out and save as .png so the background is rendered transparent. Also, you could use .svg files, which are vector graphics for the web.
- Explore all types of input. It all starts with (mouseX,mouseY) but there are many other cool input variables such as the orientation of your smart phone (although this is turned off for privacy reasons on some smartphones), microphone sound level and even camera input (including machine learning stuff like face tracking).
- It is possible to sketch both 2D and 3D (with webGL). As you can load images, you can also load 3D files (obj) and do interesting things with these.
- As data input, it is possible to load JSON files, which can be used for data visualization.
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
- Check out examples in the online editor
- Check out examples in on p5 website
- Check out the reference page
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.
Other P5/Javascript links
- Nice javascript library, do not know whether this is possible to integrate but woth a look!
- Having a sketch in the background
- Video stuff
- Posenet tutorial using ml5
- Cool artist
- Cool noise info from cool designer/artist
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!)