p5.js

202212182057
Status:
Tags: Creative Coding
Link

Overview

p5.js is a Javascript library designed for creative coders

Functions

Two main functions:

  • setup() runs once
  • draw() runs repeatedly, used for animation
let x = 0;
 
function setup() {
  background(100);  
}
 
function draw() {
  ellipse(x, height/2, 20, 20);
  x = x + 1;
}

example of the two function setup

Methods

createCanvas(x,y)


References

The Coding Train p5.js