What is P5.js?

Lauren McCarthy, creator of P5.js explaining the many different things you can do with her program.

p5 is a beginner-friendly, open-source JavaScript library geared towards artists, students and pretty much anyone interested in using code for creative expression.

It was created by Lauren McCarthy as an extension of Programming by Dan Schiffman of The Coding Train, a brightly-colored educational YouTube channel dedicated to teaching code through fun, creative exercises and games.

When using P5, users use basic JS code to focus on creating and editing audiovisual elements using such as shapes, colors, animations and even sound. The neat part is when elements become interactive, as shown in the introductory video where Schiffman prompts the visitor to click on the example circle to the left of him. Doing so changes the color of the circle when clicked, and Schiffman also demonstrates the code used to create this effect as outlined below.

Sadly, clicking the circle in this screenshot won’t change the color, but you can take my word for it or try it out yourself here.

Why use P5.js?

If you’re a novice, artist, or someone who doesn’t come from an extensive “tech” background but have any interest in learning how to create simple yet effectively-cool elements from scratch using code, p5 is an excellent place to start.

The beauty lies within its simplicity and accessibility, so go ahead, play around with code, experiment, make some mistakes, find your hidden inner artist and have fun!