xxxxxxxxxx
43
function setup() {
createCanvas(500, 240);
let hex = "0000FF";
let url = `https://php-noise.com/noise.php?hex=${hex}&json`;
//loadJSON("https://php-noise.com/noise.php?hex=${hex}&json", printData);
loadJSON(url, printData);
noLoop();
}
function printData(data) {
console.log(data);
img = createImg(data.uri, "new");
//img = createImg(data[0].url, "new");
//img = createImg("https://cdn2.thecatapi.com/images/X1Xdbh7L9.jpg","noimage");
}
function draw() {
background(random(0, 255), random(0, 255), random(0, 255),220);
noStroke();
for (let x = 50; x < width; x += 10) {
for (let y = 50; y < height; y += 10) {
//fill(random(0,255), random(0,255), random(0,255));
//let alpha = noise(x + frameCount * 0.02, y + frameCount * 0.02) * 50;
fill(random(0, 255), random(0, 255), random(0, 255), random(60,100));
//rectMode(CENTER);
rect(x, y, 6, 6);
}
}
textSize(31);
textFont('Georgia');
fill(random(210,248));
text("PROGRAMMING FROM A TO Z", 48, 40);
//fill(255, 255, 255);
}
function keyTyped() {
if (key === 's') {
saveCanvas('bookcover', 'png');
}
}