ART299: How to set up a local server on Mac to test for develop p5.js on local computer. & DC2

There are lot of ways to develop using Processing. Using Processing language and create pde file, using p5.js locally or editing online.

1) Today I used Processing language using P3 sketch, which is different from p5.js. For example, setting the canvas size is “size(600, 400);” whereas p5.js is “createCanvas(600, 400);”. P3 creates pde file and play button generate visuals. However, Processing is written in Java and it creates applets, which often crashes systems according to Daniel Shiffman.

2) I also used p5.js by downloading p5.js library and folder set up.

3) I can also use p5 editor at https://alpha.editor.p5js.org/
You can view the visual by open the index.html file, which opens sketch.js to show the visual.

But it is better to set up an local host in your development computer, the instruction are at https://github.com/processing/p5.js/wiki/Local-server.
In case of Mac, run terminal to run Python local server by entering:
“python -m SimpleHTTPServer”.

It will set up 0.0.0.0 local IP address on port:8000.

Then go to browser to enter:
http://localhost:8000” then go to the folder where index.html and sketch.js resides.
It will open the http://localhost:8000/p5/empty-example/ to show the visual.

In case of browser p5.js editor, you can save code if you have an account.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s