xxxxxxxxxx
64
// paste in your own tx hash and click play
const inputTxHash = "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060";
// you can verify the generation script at https://ipfs.io/ipfs/QmTfs2ULq5BC8P56nkHQCwMAFRhA6nYCNTzXKXJg7Di8M1
let transactionHash = inputTxHash;
const squares = [];
const colors = [
"#000000",
"#CECECE",
"#1A1AAD",
"#BE2633",
"#E06F8B",
"#4B0000",
"#EA0700",
"#EB8931",
"#F7E26B",
"#003100",
"#44891A",
"#A3CE27",
"#223F5E",
"#005784",
"#31A2F2",
"#B2DCEF",
];
function setup() {
createCanvas(800, 800);
background("white");
let count = 2;
for (let b = 8; b < width; b += 100) {
for (let a = 8; a < height; a += 100) {
const color = getColor(transactionHash[count]);
squares.push(new Square(a, b, color));
count += 1;
}
}
}
function getColor(input) {
const colorIndex = parseInt(input, 16);
return colors[colorIndex];
}
function Square(x, y, color) {
this.x = x;
this.y = y;
this.show = function () {
noStroke();
fill(color);
rect(this.x, this.y, 85, 85, 10);
};
}
function draw() {
for (var b = 0; b < squares.length; b++) {
squares[b].show();
}
}