xxxxxxxxxx
34
let fondo;
let m;
let c;
let t = 0;
function setup() {
createCanvas(400, 400);
fondo = createImage(400,400);
}
function draw() {
background(220);
if(t + 500 < millis()){
t = millis();
fondo.loadPixels();
m = random(-30,30);
c = random(-100,100);
while( m*10 + c != 10){
m = random(-30,30);
c = random(-100,100);
}
console.log("m: "+m+" c: "+c);
for(let x = 0; x < fondo.width; x++){
for(let y = 0; y < fondo.height; y++){
if(int(m)*x + int(c) - y== 0){
fondo.set(x,y,color(0,0,255));
}
}
}
fondo.updatePixels();
}
image(fondo,0,0);
}