Creative Coding with P5.js
Last year, during one of the many lockdowns, I participated in a hackathon or a maker jam where I produced some sketches using P5.js. Since then I thought it would be good to dust of my knowledge of proce55ing in general and revisit it to produce some web-art sketches. One of these turned into this. Now, I’m hoping to teach a course of Creative Coding for artists using P5.js and embedded computing. I willl therefore be collecting some useful links here to help artists looking to start working with code. I have taught Arduino before, but that was a while ago, and the ecosystem of hardware and techniques have moved on, however the basic principles remain the same. I’ve chosen P5.js because it is a web-based language that can be used directly in the browser, making quick and easy web-based art projects possible for artists. However, it is also powerful enough to be used for more sophisticated tasks and helps build knowledge of Javascript, which is a very useful programming language that is still growing in popularity. However, coding using microprocessor- based hardware such as Arduino, D1 mini, Rpi Pico or BBC Micro:bit means that it is helpful to learn the basics of older, more terse and yet powerful languages such as C (Even though most of these come with options such as Python and even Scratch and NodeRED as alternatives). So there will be a quick introduction to both C and JS as well as to the framework of P5.js.
The course will start with the basics of programming on both JS and C and will develop from there, providing the necessary information to allow an artist to code their own interactive graphics and create interactive digital artworks with a number of inputs and outputs. The following topics will be covered on the course (9–19 are based on “The Nature of Code” by Daniel Shiffman):
0. What is a programming language? How code tells a computer what to do. What is an input? what is an output?
- What is C? What is JS? What is P5? What is an API? What’s the difference between C & JS?
2. Variables, expressions and assignment
3. Flow control — conditional statements and loops
4. Functions
5. Operators and Keywords
6. Objects, Structs, Arrays — 1D and 2D
7. Inputs/Outputs — in the computer and outside of it. Arduino week.
8. 2D Co-ordinate Geometry with a Computer
9. Randomness
10. Vectors — more co-ordinate geometry
11. Forces — and other formulae
12. Oscillation — trigonometry
13. Particle Systems
14.Physics Libraries
15. Agents
16. CAs
17. Fractals — L-Systems and Recursion
18.GAs
19. ANNs
20. NFTs
Further Reading — For those dedicated to learning a more complete and rich picture of programming, I recommend “A Book On C” by Al Kelley and Ira Pohl and this for Javascript.