xxxxxxxxxx
//Note: you only need to read and edit the function drawLinesBetweenPins
function setup() {
createCanvas(600, 600);
noLoop();
}
function draw() {
background(100);
//Returns an array of objects, each with an x and y property.
const pins = createPins(20);
drawPins(pins);
drawLinesBetweenPins(pins);
}
function drawLinesBetweenPins(pins){
//TODO: Implement this function properly
//Draw a line from each pin to EVERY other pin.
// You should end up with a web of crossing lines.
// The following draws a line, but it's in the wrong place!
// and we need more of them!
stroke('white')
//replace this code!
line(0, 100, 300, 200)
}
//Note: you don't need to change this function
function drawPins(pins) {
fill('yellow');
//Done for you: draw a small yellow circle at the position of each pin
for (let pin of pins) {
circle(pin.x, pin.y, 8);
}
}