xxxxxxxxxx
46
// code by niky
// highly based off of:
// https://editor.p5js.org/bengrosser/sketches/fBtPutnIb
let numInput1;
let numInput2;
let num1 = [];
let num2 = [];
let drawShape = false;
function setup() {
createCanvas(400, 400);
numInput1 = select('.num1');
numInput1.changed(getNum1);
numInput2 = select('.num2');
numInput2.changed(getNum2);
frameRate(10);
textSize(32);
colorMode(RGB);
background(250);
}
function draw() {
background(220);
for(let i = 0; i < num1.length; i = i + 1) {
for(let i = 0; i < num1.length; i = i + 1) {
rect(num1[i],num2[i],20,20);
}
}
if(drawShape == true) {
rect(0,0,100,100);
}
}
function getNum1() {
num1.push(numInput1.value());
}
function getNum2() {
num2.push(numInput2.value());
}