xxxxxxxxxx
19
// The Nature Of Code 2
// Chapter 1 : Vectors
let pos;
function setup() {
createCanvas(400, 400);
background(0);
}
function draw() {
translate(width / 2, height / 2);
stroke(255, 100);
strokeWeight(2);
pos = p5.Vector.random2D();
pos.mult(random(100, 150));
line(0, 0, pos.x, pos.y);
}