Three ways to work with p5.js
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 209 interviews, case studies, and tutorials, along with over 272 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!
Related
I am really excited to announce that I’ve finally released my brand new course Building Tools today! I just added […]
Two thousand and twenty-four. At the “Barceloneta” metro station, a few hundred meters from the beach, stands an old dot-matrix […]
In an age of increasing digital consumption, Hannah, a recent visual communication graduate, explored “Permacomputing”—a sustainable approach to technology inspired […]
Click here to login or connect!To view this content, you must be a member of Tim's Patreon at €7 or […]
Limitations have always been playing a major role in my creative work; I was only able to develop my best […]
In this interview, Copenhagen-based creative director Tameem Sankari shares his journey into Creative Coding, combining Processing, Blender, and Adobe CC. […]
In this post I’d like to introduce you to Sam Griffith, a talented graphic designer based in Detroit, to discuss […]
The next edition of the DEMO Festival is already approaching and I am currently developing a brand new talk for […]
20 = 1 21 = 222 = 323 = 824 = 1625 = 3226 = 6427 = 128 … »In […]
This is a call for coding designers. It aims to serve as a proposal and a provocation for creative work […]
Hi! In this post I’ll collect case studies and direct links to tools that people have built with p5.js and […]
Your 128kb journey starts here! This is a template you can use to start developing your idea within the 128kb […]
In 2022, I spontaneously posted a story on Instagram: If anyone out there is also in Rotterdam, I’d love to […]
One day in early 2024 I started to experiment with a new idea. I wrote down a set of rules […]
During OFFF Festival here in Barcelona, many interesting people come around! This interview with Talia Cotton came about almost by […]
Lena: This 10-minute visualiser for A. G. Cooks album teaser featuring my python archive generator, is one of my favourite […]
Hi Anna! It was super nice to meet you at the PCD CPH, I really liked your talk in which […]
When I held Martin Lorenz’s new book in my hands and turned it onto its back, I was a little […]
Hey folks, I hope you are doing great! You may have already read one or two of my essays that […]
Instagram, Twitter, TikTok… All the main platforms that technically have the required features to connect emerging communies for Creative Coding […]
In my teaching at universities and in workshops, I have met many very enthusiastic and highly talented people who have […]
One of the first exercises I assign to my students in my seminars is called “Random Compositions”. Basically, it’s quite […]
I’ve been travelling a lot in the last few months. Still, it was only during a short stay in Copenhagen […]
For me, it’s by far the most inspiring project of the last few years: “Symphony in Acid”, a collaboration between […]
Sometimes it is so difficult to display the potencial of Creative Coding, since it mostly happens in the digital realm, […]
In this conversation Daniel and I discussed a broad range of topics, from the role of AI in Creative Coding to the beauty of Object Oriented Programming.
Please note: This is a interim state of this interview, I am currently working on the edit. Stay tuned! How […]
“Think Different” If you are as old as me, you probably remember the iconic advertisement of Apple with the bold […]