Having fun coding with p5.js

p5js
p5.js is an effort to port the ideas and concepts of the Processing programming language to JavaScript.

Even though there’s already processing.js –which transcodes Processing code into JavaScript–, p5.js is built with extensibility in mind, trough plugins, and instead of writing Processing code to be transcoded, you write pure JavaScript.

The other day I saw the p5.js launch presentation, and loved it. It made me do several double-takes as it shows wizardly things that you usually don’t see on video.

So I gave it a whirl. Following the very detailed examples on their site I was able to quickly put together a web toy that records audio through your microphone and then allows you to reproduce it, changing the volume and speed. Here it is:
(you have to accept the microphone prompt in your browser in order for this to work)

Here’s the code in github

It was quick, painless and fun. In fact, this was the most fun that I’ve had in a long while learning a new JavaScript library. The onboarding experience that these guys have in their website it’s absolutely great.

I’ve never learned Processing, but have seen some wicked visualizations done with it. Seems like the routines and the concepts in p5.js are very similar, and the first thing that came to mind when I dove into it was Logo, my first language. I think it’s the procedural, sequential nature of it. The rules are very clear, each instruction modifies the context, and there’s this pervasive idea that you’re drawing in a canvas object in a web page.

I bet p5.js would make for a great introduction to programming for kids, with the added benefit that, along the way, any beginner that starts with p5.js would be learning one of the most popular languages today. And having fun at the same time.

p5.js website

 



By Daniel Pradilla

Soy arquitecto de software y ayudo a la gente a mejorar sus vidas usando la tecnología. En este sitio, intento escribir sobre cómo aprovechar las oportunidades que nos ofrece un mundo hiperconectado. Cómo vivir vidas más simples y a la vez ser más productivos. Te invito a revisar la sección de artículos destacados. Si quieres contactarme, o trabajar conmigo, puedes usar los links sociales que encontrarás abajo.

Discover more from Daniel Pradilla

Subscribe now to keep reading and get access to the full archive.

Continue reading