A simpler way to create JavaScript

Inspired by accessible programming language Processing, p5.js makes it easy for anyone to sketch rich JavaScript apps.

Processing is a brilliant programming language aimed at more at artists and designers than at coders. Designed to help non-programmers get started with programming, it makes it easy for get instant visual results from your code. It's possible to run Processing programs in a browser using Processing.js, but now there's an alternative in the form of p5.js.

Currently in beta, it's a JavaScript library that starts with the original Processing goal of accessible coding, but that enables you to create attractive JavaScript examples that run directly in the browser.

You can create simple interactive apps like this with a few lines of code

Created by New York-based artist and programmer Lauren McCarthy and a team of contributors, p5.js is a software sketchbook for the web that features all of Processing's drawing functionality, but also lets you use add-on libraries to interact with HTML5 objects such as video and sound.

Long-time Processing fan Brendan Dawes has already been experimenting with p5.js, and has used it in conjunction with PhantomJS to generate a new sine wave-based header image for his Twitter account every hour. See how he did it here.

Brendan Dawes uses p5.js to generate these fab sine wave-based images for his Twitter account

While it's a new interpretation of Processing rather than a straight port, it's easy to switch to pf.js and convert existing Processing projects to p5.js; there are instructions on the site. There's also an official editing environment on the way; if you have a Mac you can download an alpha version today. Otherwise you can simply use your preferred text editor; there are instructions for setting p5.js up with Sublime Text 2 on the site, along with loads of tutorials and code examples to help you get started.

ABOUT THE AUTHOR

Jim McCauley is a writer, editor and occasional podcaster, and is available for space parties.