Programming for Interactive Digital Arts
CS 2, Fall 2023

SA 11. Due: Mon, Nov 13

This short assignment is for you to learn how to use p5js outside of the Web-based p5js editor, so that you can code locally on your own laptop.

  • READ Setting up p5.js with an editor on your own computer
  • Login to your p5js Web account and make a New sketch.
  • Rename the sketch to sa11 and save it (File->Save).
  • Download your sa11 sketch by selecting File->Download.
  • Locate the downloaded folder, rename it, and move to your CS2 folder.
  • Download a code editor, I suggest VS Code, but you can use Brackets, Submlime Text 2, vi or other editor.
  • Open your downloaded sa11 folder by selecting the menu item "File->Open Folder"
  • Click sketch.js in the left file browser pane
  • Save an image file into the sa11 folder, e.g. butterfly.png
  • Edit your sketch.js in VS Code to load and display your image, e.g. loadImage("butterfly.png")
  • Now, either in a terminal (cd yourCS2dir/sa11) and run a local server by following the Local Server instructions on the p5js Web site. python -m http.server
  • Go to your browser (Firefox, Safari, Chrome) and navigate to http://localhost:8000
  • Take a screenshot of your running sketch in the browser.
Submit your screenshot of your sketch running locally in your browser, and also turn in your compressed sa11 directory with your sketch files on Canvas.