Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

What's p5.js?

p5.js is JavaScript (JS) library, which is used for creating for creating graphic and interactive experiences for artists and developers. The code is written directly in JS, and it gets executed like any other JS file that is included on a website. It requires an empty HTML file that links to the p5.js library and your sketch file in the header. 

p5.js based on the core principles of Processing, but there are some differences in the language syntax

Using p5.js

For the purpose of the course we are going to use Openprocessing.org. It's an online platform, where anyone can create and share visual-based, open source projects. The big advantage of open processing is that the users can like and comment other users can like and comment other sketches, follow other follow other users and create and create themed collections. 

Alternative Editors

p5.js has its own web-based editor which compiles the code on the go and displays it directly in the browser.

Processing IDE, which has to be put in p5.js mode in order to compile the JS code. It consists of consists of three main parts. 

  1. The text editor, where you can write (or paste in) the code.

  2. Message area and Console/Errors window. The Message area which displays the errors and is useful to see if you e.g., miss a semicolon.

     The Console

     The Console/Errors window displays warnings, but can be also used to output text for debugging.

  3. The final part is the Display window. This is where you can see the results of our code after it is compiled, by pressing the Run button in the upper left corner. 

...

The third option is to use one of the text editors e.g. Sublime, Atom, Visual Studio Code and run p5.js directly on your computer. For that you would need to download a complete p5.js library and run the code on a local server.

Examples

In order to understand the examples and to write your own programs, you will be using references, i.e. artifacts that describe a programming language.