Developing p5.js Programs

By Michelle Ma (TA, Fall 2015, updates by Tom Cortina, Fall 2020)


Text Editor

Pick an editor to enter your program code. Sublime is popular but will gently bug you to send money. Atom is free. Komodo Edit 9 is free. Bluefish is also free, open-source, fast and simple on the Mac, but the windows install process seems to be a little more difficult than that of others.

All three editors have built-in support for adding colors to JavaScript programs (called “syntax highlighting”).


Project templates

For projects early in the semester (no sound, no attempts to access HTML content), you can use the template2023-p5only.zip file. Otherwise, use template2023-all.zip. The “-min” templates are for your personal website or other use outside of class where you want the fastest downloads. Read more about them below.

After downloading the template, expand it (probably you can double-click on it in your file browser/finder/explorer) and name the expanded directory to your project name. We’ll call this your project directory.

Reference Lab 1 for details on how to edit a program, save it and run it in a browswer.


Configuring Sublime

If you use Sublime, it will, by default, insert TAB characters into your code when you type the TAB key. Tabs are a problem because different editors and text displays interpret TABs differently, which means your carefully indented code may look like garbage in another editor, on Piazza, or on Autolab.

Please change your Sublime settings as follows:


The Chrome Developer Tools

Use the View / Developer / Developer Tools menu in Chrome to open the developer tools window.

Things you can do in Developer Tools: