p5.js Basics

p5.js Logo

P5.js is an open-source Javascript library for creative coding.

This module is an introduction to installing and using this powerful library built for artists, designers, educators, and learners.

Objectives

Upon completion of this module, you should be able to:

  • Create new p5.js projects using the web editor.
  • Create new p5.js projects on your local machine.
  • Describe the purpose of the setup and draw methods.
  • Resize the drawing canvas and query for the canvas height/width.
  • Draw 2D shapes to the canvas in a variety of colors.
  • Optionally clear the background before each frame.
  • Translate, rotate, scale, save, and restore the coordinate system.
  • Respond to keyboard and mouse events.
  • Display images to the canvas.
  • Display text in the debugging console and on the canvas.
  • Load and play sound files.

Linked Resources

Linked resources will be identified with the following emoji:


Table of contents