xxxxxxxxxx
58
// const Srl = TotalSerialism;
// const Mercury = MercuryParser;
let pg;
let arr = [];
for (var i=0; i<10; i++){
arr[i] = Math.random();
}
// console.log(arr);
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
const txtR = createInput();
txtR.value(4);
txtR.input(drawGrid);
txtR.position(0, 0);
txtR.size(windowWidth);
frameRate(5);
pg = createGraphics(1, 1);
let display = [];
let squares = 4;
}
function draw() {
// background(0);
// console.log(width/height);
// let w = Math.ceil(Math.sqrt(squares*width/height));
// let h = Math.floor(Math.sqrt(len));
// display = Srl.Utility.normalize(display);
texture(pg);
rect(-width/2, -height/2, width, height);
}
function drawGrid() {
// let r = Mercury(`list val ${this.value()}`);
// display = r.parseTree.variables.val;
// console.log(display);
pg = createGraphics();
let numPix = width*height;
for (var x=0; x<width; x++){
for (var y=0; y<height; y++){
let i = (x + y*width) / numPix * arr.length;
pg.set(x, y, arr[i]*255);
}
}
pg.updatePixels()
}