xxxxxxxxxx
38
let nameInput;
let names = [];
let yPos = 0
function setup() {
createCanvas(400, 400);
nameInput = select('.name');
nameInput.changed(getName);
frameRate(10);
textSize(32);
background(220);
}
function draw() {
//background(220);
for(let i = 0; i < names.length; i = i + 1) {
text(names[i],random(width),random(height));
}
yPos = yPos - 1;
if (yPos < 0) {
yPos = height;
}
line(0, yPos, width, yPos);
}
function getName() {
names.push(nameInput.value());
if(nameInput.value() == "bananas") {
background((255),(225),(53));
}
if(nameInput.value() == "bananas") {
line(0, yPos, width, yPos);
}
nameInput.value("");
}