p5art

Introduction to p5!

Functions

P5 is a library of functions. A function is simply a block of code that does a task.

Think of it like a scratch block. A Scratch block has a name and usually takes in a value or parameter.

Scratch

A function is the same idea. Each function has a name that we can use to call the function. Most functions take one or more parameters. Some functions take no parameters.

Functions

To draw a circle use can use the ellipse function, and give it 4 parameters.

Exploration

For more on drawing circles, check out the Circles page.

Basic Setup

We call a p5 project a sketch, as in sketchbook, because they are quick to start! For every sketch, two functions most defined for the sketch to run properly.

Basic Sketch

The p5 editor automatically includes these for you. You can change the values to change the canvas size and the background color.