p5 Js
p5 Js
js
2D Primitives Attributes Environment Structure
strokeWeight(weight) print(string) function preload(){
(x1, y1)
line(x1, y1, x2, y2) run once before setup():
set the width of the stroke = console.log() asynchronous function
//load data
(x2, y2) background(color) cursor(TYPE) }
set the background color ARROW, CROSS, HAND, MOVE, TEXT
function setup(){ run once when the program starts
(x1, y1) rect(x1, y1, width, height)
fill(color) framerate(fps)
height
createCanvas(width, height); create a canvas, size in pixels
set the fill color change frame per second
width noLoop(); stops continuously executing draw()
stroke(color) windowResized()
}
ellipse(x1, y1, width, height) set the stroke color called when window resized
(x1, y1) function draw(){ run continuously after setup()
height
noFill()
//draw
width disables fill
Rendering }
arc(x1, y1, width, height, start, stop) noStroke() createCanvas(w, h)
(x1, y1) disables stroke redraw()
stop height
resizeCanvas(w, h)
executes the code in draw() once
start
Conversion input(function)