Creative coding using p5.js - Workshop: An introduction to creative coding using p5.js.
complementary slides: GitHub, 2.12 MB
p5.js version: 0.4.20
The purpose of the project is to illustrate and teach some basic drawing and interaction features of the creative coding library p5.js. This activity is meant to be held in a workshop-like format and step by step to the participants using live coding, supported by the here illustrated and commented source code.
Following, a brief overview about the project's content is given as it is illustrated during the workshop:
- Introduction of the p5.js base frame, including p5.js's setup() and draw() cycle.
- Drawing of a simple (static) ball.
- Ball movement along the x-axis.
- Implementation of a bouncing effect, so the ball stays within the application window.
- Drawing some application feedback, such as FPS, the mouse's position as well as the currently pressed key, directly to the application's window.
- Refactoring of the ball instance's code into a separate dedicated class.
- More keyboard input: Increasing/decreasing the ball's radius.
- Implementation of the feature to let the ball follow the mouse's position, once the mouse clicked the ball.
- Introduction of the random() function in order to randomize the initial position of the ball as well as randomly changing the color of the ball once it was clicked.
MIT License, see LICENSE.md