xxxxxxxxxx
23
let pt1 = 0;
let pt2 = 300;
let y = 200;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
translate(50, 0);
line(0, y, pt2, y);
fill(255, 0, 0);
ellipse(pt1, y, 50, 50);
text(pt1, pt1, y-40);
fill(255);
ellipse(pt2, y, 50, 50);
text(pt2, pt2, y-40);
let pt3 = lerp(pt1, pt2, 0.5);
fill(0, 0, 255);
ellipse(pt3, y, 50, 50);
text(pt3, pt3, y-40);
}