Three ways to work with p5.js

Published by Tim on Thursday September 1, 2022

Last modified on October 8th, 2024 at 14:43

When the first alpha release of p5.js appeared in July 2014, it kicked off a hugely important development for the idea of Processing. A brief recap: Processing is now over 20 years old and was written in the Java programming language, which was very hot at the time. At the time, Java even allowed Processing apps to be embedded in web pages, but browser vendors eventually capped this feature for various reasons. In order to close the gap that this opened up and make the great ideas of Processing usable on the World Wide Web again, p5.js was developed.

Since the technologies of the World Wide Web are very complex, powerful and versatile, p5.js brings many more possibilities into play compared to Processing, but also a bit more complexity, especially when it comes to getting started with Creative Coding.

The question that arises at the very beginning is which code editor you should work with best. From my point of view there are three different possibilities, which I would like to explain here.

Option 1: The web-editor

The easiest and fastest way to work with p5.js is the official p5.js web editor. Provided you have an Internet connection, you can access it directly at https://editor.p5js.org/ and do not need to install anything to write code in p5.js. For smaller sketches and experiments this tool is absolutely sufficient. The editor basically has everything you need to get started quickly. However, if you are working on a larger project for a longer time, I would recommend you to go a step further, because with the web editor you will reach the limits at some point.

By the way, I would like to express here my greatest appreciation to the developers of the p5.js editor. Without people like Cassie Tarakajian, and the many contributors who put a lot of love and effort into the project, something like this would not be possible.

  • Pros
    • easy to use
    • no installation needed
    • works smoothly
  • Cons
    • all in one browser window. Can feel quite tight
    • all sketches are saved in the cloud
    • not that scalable

Option 2: The Processing application with p5.js mode

For those who have already worked with Processing and would like to work offline, the, the p5.js mode is interesting. It allows you to write p5.js code directly in the Processing app, which works super well according to my research. I myself would prefer the solution over the p5.js web editor, because it makes it much easier to store all my sketches on my own hard drive and not have to store everything in the editor cloud.

  • Pros
    • keep everything on your hard drive
    • Great for people coming from Processing
  • Cons
    • not sure if it works as stable as it should

Option 3: An advanced Code editor like Visual Studio Code

If you are working on more complex projects in p5.js, it is definitely time for you to take a look at Visual Studio Code. Microsoft’s code editor is free, open source and extremely versatile. It is the high-end professional solution for your web projects. However, the complexity of VSCode can be quite overwhelming and if you are a beginner, I would advise you against it for now, as you should be very mindful of your motivation.

For working with p5.js there are some utilities I would like to recommend to you. First, I use the Live-Server Extrension, which adds a button that runs your sketch on a web server. Clicking on “Go Live” opens a browser window where your sketch is running. Changes are injected directly into the browser window when you save the code, which is quite helpful.

For creating and managing p5.js sketches, there’s the p5.vscode extension by American media artist Sam Lavigne, who I really admire. Beyond that, there are many other extensions that I haven’t tried.

VSCode even has a built-in terminal, Git integration, and all sorts of other bells and whistles.

  • Pros
    • extremely scalable
  • Cons
    • most complicated
    • a bit overwhelming for beginners

Conclusion

In short, for complete beginners, p5.js Web Editor is probably the best choice. The simplicity and completeness of the tool will help you not to lose the overview. While processing for using p5.js is not really popular, it is definitely an alternative with a few advantages. To really break out of the confines of the web editor, VSCode is the best choice. It’s probably the last code editor you need to learn.

What is your favorite way to use p5.js? Or is there even another, better way to do so? Please post your idea on our Discord-server to spark a discussion!

Enjoying the content?

I put a lot of love and effort into developing content on Creative Coding. Since 2018, I have published 220 interviews, case studies, and tutorials, along with over 280 lessons in 17 online courses – and there's more to come! If you'd like to support my work and help keep this platform evolving, please consider supporting me on Patreon. Thank you very much!

Speaking Image

Monthly Newsletter

Fresh perspectives circling around Creative Coding, Design and Technology, every first Friday of the month, directly to your inbox.

Related

Luna Maurer on Designing Friction

In December 2024, I was at the Iterations conference in s’Hertogenbosch (Netherlands) and there she was: Luna Maurer! I’ve known […]

Demystify Technology

The guiding principle in my teaching and in the development of this platform is “Demystify Technology”. The Problem When people […]

Studio visit: Julian Hespenheide

Two thousand and twenty-four. At the “Barceloneta” metro station, a few hundred meters from the beach, stands an old dot-matrix […]

Hannah Gmeiner on Permacomputing in Graphic Design

In an age of increasing digital consumption, Hannah, a recent visual communication graduate, explored “Permacomputing”—a sustainable approach to technology inspired […]

DEMO 2025 – My Submissions

Limitations have always been playing a major role in my creative work; I was only able to develop my best […]

Tameem Sankari on Creative Coding for Large Media Corporations

In this interview, Copenhagen-based creative director Tameem Sankari shares his journey into Creative Coding, combining Processing, Blender, and Adobe CC. […]

Sam Griffith connects Creative Coding with Enviromentalism

In this post I’d like to introduce you to Sam Griffith, a talented graphic designer based in Detroit, to discuss […]

Throwback: My Talk at Demo Festival 2022

The next edition of the DEMO Festival is already approaching and I am currently developing a brand new talk for […]

Powers of Two – 128kb by Lena Weber

20 = 1 21 = 222 = 323 = 824 = 1625 = 3226 = 6427 = 128 … »In […]

A Call for Coding Designers

This is a call for coding designers. It aims to serve as a proposal and a provocation for creative work […]

p5.js Design Tools Directory

Hi! In this post I’ll collect case studies and direct links to tools that people have built with p5.js and […]

A p5.js starter template for the 128kb Challenge

Your 128kb journey starts here! This is a template you can use to start developing your idea within the 128kb […]

Omid Nemalhabib explores the intersection of Creative Coding and Perso-Arabic Typography

In 2022, I spontaneously posted a story on Instagram: If anyone out there is also in Rotterdam, I’d love to […]

The 128kb Framework and its Aesthetic Characteristics

One day in early 2024 I started to experiment with a new idea. I wrote down a set of rules […]

A conversation with Talia Cotton

During OFFF Festival here in Barcelona, many interesting people come around! This interview with Talia Cotton came about almost by […]

Lena Weber about her collaboration with A. G. Cook

Lena: This 10-minute visualiser for A. G. Cooks album teaser featuring my python archive generator, is one of my favourite […]

A conversation with Anna Shams Ili

Hi Anna! It was super nice to meet you at the PCD CPH, I really liked your talk in which […]

Coding Systems: New Workshop Dates!

When I held Martin Lorenz’s new book in my hands and turned it onto its back, I was a little […]

My new writing project “downgrade” is live

Hey folks, I hope you are doing great! You may have already read one or two of my essays that […]

Join the 128kb challenge!

Instagram, Twitter, TikTok… All the main platforms that technically have the required features to connect emerging communies for Creative Coding […]

Ruder Processing Unit by Kevin Koch

In my teaching at universities and in workshops, I have met many very enthusiastic and highly talented people who have […]

A reflection on Processing Community Day Copenhagen 2023

I’ve been travelling a lot in the last few months. Still, it was only during a short stay in Copenhagen […]

Ksawery Kirklewski on his Symphony in Acid

For me, it’s by far the most inspiring project of the last few years: “Symphony in Acid”, a collaboration between […]

Coding Systems

How does Creative Coding relate to the broad term “systems theory”? This question has been the subject of many conversations […]

Computer Cursive by Tay Papon Punyahotra

One of the first exercises I assign to my students in my seminars is called “Random Compositions”. Basically, it’s quite […]

Vera Molnar Reconstructed 3/3

Click here to login or connect!To view this content, you must be a member of Tim's Patreon at €7 or […]

Vera Molnar Reconstructed 2/3

Click here to login or connect!To view this content, you must be a member of Tim's Patreon at €7 or […]

Vera Molnar Reconstructed 1/3

Click here to login or connect!To view this content, you must be a member of Tim's Patreon at €7 or […]

My brand new course “Building Tools” is live!

I am really excited to announce that I’ve finally released my brand new course Building Tools today! I just added […]