<!DOCTYPE html>
<html>
<head>
<script src="/content/b6a50f5ba932b0ea7f652d9d28e59eced47bc6f8376c25e02d8b3457bb60ac8fi0"></script>
<style>
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
height: 100vh;
background-color: #f0f0f0;
overflow: auto;
}
#controls {
width: 100%;
background-color: rgba(255, 255, 255, 0.8);
padding: 10px;
box-sizing: border-box;
z-index: 10;
}
#controls input {
font-size: 16px;
padding: 5px;
}
#canvas-container {
flex: 1;
width: 100%;
display: flex;
justify-content: flex-start;
align-items: flex-start;
position: relative;
padding: 10px;
}
canvas {
border: 1px solid #ccc;
display: block;
}
</style>
</head>
<body>
<div id="controls">
<input id="blockNumberInput" type="number" placeholder="Enter block number" />
</div>
<div id="canvas-container"></div>
<script>
let canvas;
let blockNumber = 1;
const colors = [
'#000000',
'#f3d9c2',
'#c8b7e3',
'#f5aab6',
'#d3c6e0',
'#f4a261',
'#fa8072',
'#98fb98',
'#87ceeb',
'#ffb6c1'
];
function setup() {
canvas = createCanvas(600, 600);
canvas.parent('canvas-container');
noLoop();
document.getElementById('blockNumberInput').value = blockNumber;
generateArt();
window.addEventListener('resize', resize, true);
resize();
document.getElementById('blockNumberInput').addEventListener('input', updateArt);
}
function updateArt() {
blockNumber = parseInt(document.getElementById('blockNumberInput').value, 10) || 290304;
generateArt();
}
function resize() {
const root = document.getElementById('canvas-container');
root.style.width = window.innerWidth - 300 + 'px';
root.style.height = window.innerHeight + 'px';
const orgWidth = 600;
const orgHeight = 600;
let scaleW = window.innerWidth / orgWidth;
let scaleH = window.innerHeight / orgHeight;
let offsetX = 0;
let offsetY = 0;
if (scaleH < scaleW) {
scaleW = scaleH;
offsetX = (window.innerWidth - orgWidth * scaleW) / 2;
} else {
scaleH = scaleW;
offsetY = (window.innerHeight - orgHeight * scaleH) / 2;
}
canvas.style.zoom = scaleW;
scaleFactor = Math.min(width / 1000, height / 1000);
redraw();
}
function generateColors() {
let colorIndex = (blockNumber - 1) % colors.length;
background(colors[colorIndex]);
}
function generateArt() {
clear();
generateColors();
if (blockNumber % 2 !== 0) {
let positions = [
{ x: 50, y: 50, size: 40 },
{ x: 550, y: 50, size: 40 },
{ x: 50, y: 550, size: 40 },
{ x: 550, y: 550, size: 40 }
];
for (let pos of positions) {
drawBitcoinLogo2(pos.x, pos.y, pos.size);
}
}
if (blockNumber % 2 === 0) {
let positions = [
{ x: 50, y: 50, size: 40 },
{ x: 550, y: 50, size: 40 },
{ x: 50, y: 550, size: 40 },
{ x: 550, y: 550, size: 40 }
];
for (let pos of positions) {
drawBitcoinLogo3(pos.x, pos.y, pos.size);
}
}
drawPizza(300, 300);
drawStars();
}
function drawStars() {
fill(255);
noStroke();
for (let i = 0; i < 100; i++) {
let x = random(width);
let y = random(height);
ellipse(x, y, 2, 2);
}
}
function drawPizza(x, y) {
let pizzaSize = 300;
let crustThickness = 30;
let sauceColor = '#d9534f';
let cheeseColor = '#ffeb3b';
let oliveColor = '#000';
let pepperoniColor = '#d9534f';
let greenPepperColor = '#4caf50';
let mushroomColor = '#9e9e9e';
let onionColor = '#f5f5f5';
let baconColor = '#e57373';
let pineappleColor = '#f7e2a6';
let redPepperColor = '#c62828';
let btcSize = 50;
fill('#f4a261');
noStroke();
ellipse(x, y, pizzaSize, pizzaSize);
// Draw sauce
fill(sauceColor);
ellipse(x, y, pizzaSize - crustThickness, pizzaSize - crustThickness);
// Draw cheese
fill(cheeseColor);
ellipse(x, y, pizzaSize - crustThickness * 2, pizzaSize - crustThickness * 2);
stroke('#f4a261');
strokeWeight(10);
line(x, y, x + pizzaSize / 2, y);
line(x, y, x, y + pizzaSize / 2);
line(x, y, x - pizzaSize / 2, y);
line(x, y, x, y - pizzaSize / 2);
fill(pepperoniColor);
noStroke();
ellipse(x - 80, y - 80, 30, 30);
ellipse(x + 80, y - 80, 30, 30);
ellipse(x - 80, y + 80, 30, 30);
ellipse(x + 80, y + 80, 30, 30);
fill(greenPepperColor);
beginShape();
vertex(x - 60, y - 60);
vertex(x - 40, y - 80);
vertex(x - 20, y - 60);
vertex(x - 40, y - 40);
endShape(CLOSE);
beginShape();
vertex(x + 60, y - 60);
vertex(x + 40, y - 80);
vertex(x + 20, y - 60);
vertex(x + 40, y - 40);
endShape(CLOSE);
fill(mushroomColor);
ellipse(x - 60, y - 20, 25, 20);
ellipse(x + 60, y - 20, 25, 20);
ellipse(x, y + 60, 25, 20);
fill(oliveColor);
ellipse(x - 70, y + 70, 15, 15);
ellipse(x + 70, y - 70, 15, 15);
ellipse(x - 30, y - 30, 15, 15);
ellipse(x + 30, y + 30, 15, 15);
fill(onionColor);
ellipse(x - 40, y + 40, 20, 10);
ellipse(x + 40, y - 40, 20, 10);
fill(baconColor);
beginShape();
vertex(x - 80, y - 80);
vertex(x - 60, y - 100);
vertex(x - 20, y - 80);
vertex(x - 40, y - 60);
endShape(CLOSE);
beginShape();
vertex(x + 80, y - 80);
vertex(x + 60, y - 100);
vertex(x + 20, y - 80);
vertex(x + 40, y - 60);
endShape(CLOSE);
fill(pineappleColor);
beginShape();
vertex(x - 40, y - 60);
vertex(x - 20, y - 80);
vertex(x, y - 60);
vertex(x - 20, y - 40);
endShape(CLOSE);
beginShape();
vertex(x + 40, y - 60);
vertex(x + 20, y - 80);
vertex(x, y - 60);
vertex(x + 20, y - 40);
endShape(CLOSE);
fill(redPepperColor);
ellipse(x - 70, y + 70, 15, 15);
ellipse(x + 70, y - 70, 15, 15);
stroke('#f4a261');
strokeWeight(5);
noFill();
ellipse(x, y, pizzaSize + 10, pizzaSize + 10);
drawBitcoinLogo(x, y, pizzaSize * 0.25);
}
function drawBitcoinLogo(x, y, size) {
fill('#f7931a');
noStroke();
ellipse(x, y, size, size);
fill('#ffffff');
textSize(size * 0.8);
textAlign(CENTER, CENTER);
text('\u20BF', x, y);
}
function drawBitcoinLogo2(x, y, size) {
fill('#00aaff');
noStroke();
ellipse(x, y, size, size);
fill('#ffffff');
textSize(size * 0.8);
textAlign(CENTER, CENTER);
text('\u20BF', x, y);
}
function drawBitcoinLogo3(x, y, size) {
fill('#000000');
noStroke();
ellipse(x, y, size, size);
fill('#ffffff');
textSize(size * 0.8);
textAlign(CENTER, CENTER);
text('\u20BF', x, y);
}
</script>
</body>
</html>