Now let’s draw lines from the centre of our sketch but let’s calculate the centre and randomly pick end points for our lines.
// drawing lines from the center of the canvas // why does the X and Y of second point need to be between 0 and width function setup() { createCanvas(windowWidth, windowHeight); background(0); // this makes the background black } function draw() { stroke(random(255)); // start lines in the middle of the screen (width/2, height/2) line(width/2, height/2, random(width), random(height)); }