xxxxxxxxxx
// make source code public
// schien@mail.ncku.edu.tw, Spring 2025
//
// draw a line - compared to a random line
// program for lectures on "The Wrong Way to Draw a Line"
//
// schien@mail.ncku.edu.tw, DPD 2023
//
function setup() {
createCanvas(500, 100);
noLoop();
}
function draw() {
background(255);
strokeWeight(5);
stroke(0, 30);
line(20, 50, 480, 50); // draw a line
stroke(20, 50, 70);
let randx = random(20, width-20);
let randy = random(height);
line(20, 50, randx, randy);
}