xxxxxxxxxx
27
let v1;
let v2;
let v3;
function setup() {
createCanvas(400, 400);
v1 = new createVector(40, 40);
v2 = new createVector(20, -20);
line(0, 0, v1.x, v1.y);
v1.add(v2);
// v3 = p5.Vector.add(v1, v2);
// print(v3.x, v3.y);
}
function draw() {
// background(220);
stroke(0);
line(0, 0, v1.x, v1.y);
// line(v1.x, v1.y, v1.x+v2.x, v1.y+v2.y);
// stroke(255, 0, 0);
// line(0, 0, v3.x, v3.y);
}