This project provides a server to run and share works created that use the p5.js library.
- Open the command line, us
ls
to find out where you are, usecd
to change to the right folder - Repeat until found the correct folder you download this project into.
- Type
npm run start
to host the server on your computer - Go to http://localhost:3000/ and see the work.
- Now go open an editor to change the code in sketch-#.js files in the public folder.
- Stop the server with
ctrl-c
for cancel in the command line. - type
npm run create
to add your ownsketch-#.js
files under thepublic/
folder.
command | description |
---|---|
npm run start |
Start a web server on your own computer |
npm run create |
Create a new sketch file to start editing |
ctrl-c |
Stop a running task |
You will find having the done command line project very useful in order to understand how to start the program and understand what files and paths are and how they relate. Including how to move around the file system.
Our website start project can introduce you to learning more about creating things on the web.
For those familiar with python, this python to javascript document will help you get into JS from some common concepts.
You don't need to read this to get started, but for the curious this is how the project functions
- A server makes the contents of the
public
folder accessible by a web browser from the computer running the server. - When starting, this server lists the files named "sketch-#.js" in that folder to create the menu you see on the page.
- When a page is requested by a user through a browser the server creates an HTML document from the templates in
views
. - Depending on the path the users browsers wants to get, the matching sketch number is added into the page. This logic is contained within
server.js
npm run start
starts the server by running the program "node" with the file server.js
for you.
The language you are coding is javascript. This project introduces you to using a library called p5.js which itself is written in javascript. A library is a set of functions already written for you to use. p5 gives you nice functions to use for drawing on the screen.