xxxxxxxxxx
28
// Random Vector
// The Nature of Code
// The Coding Train / Daniel Shiffman
// https://thecodingtrain.com/learning/nature-of-code/1.3-random-vector.html
// Random Vector: https://editor.p5js.org/codingtrain/sketches/qHKMdpRR
// Walker: https://editor.p5js.org/codingtrain/sketches/_HHLfcGx
function setup() {
createCanvas(1200, 800);
background('#2DC5F4');
}
function mousePressed() {
save('image.png');
}
function draw() {
translate(width / 2, height / 2);
// let v = createVector(random(-100, 100), random(-100, 100));
v = p5.Vector.random2D();
v.mult(random(100, 300));
strokeWeight(8);
stroke(112,50,126,100);
line(0, 0, v.x, v.y);
}