<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Make Your Own</title>
<style>
body {
font-family: 'Lato', sans-serif;
background: #091c2c;
}
.container {
position: relative;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.accordion {
display: block;
min-width: 500px;
max-width: 600px;
background: #a65d26;
padding: 16px 0 16px 0;
}
.header {
border-bottom: 2px solid #091c2c;
padding-bottom: 12px;
cursor: pointer;
color: #d3d3d3;
}
.row {
display: flex;
}
.column {
flex: 50%;
}
.info {
margin-bottom: 12px;
font-size: 14px;
max-height: 0px;
overflow: hidden;
transition: 30ms ease-out;
}
.listitem {
list-style: none;
display: block;
padding: 0px 40px 0 40px;
}
.open .info {
max-height: 100%;
}
.iframe {
margin: 0px !important;
}
</style>
</head>
<body>
<div class="container">
<li class="accordion">
<ul class="listitem">
<h2 class="header">
🎨 Customizations
</h2>
<div class="info column">
<div class="row">Blinking Speed: <input type="range" id="speed" min="1" max="100"></div>
<div class="row">Pixel Size: <input type="range" id="size" min="6" max="70"></div>
</div>
<div class="info column">
<input type="text" id="color1" placeholder="#ffffff" maxlength="7">
<input type="text" id="color2" placeholder="#ffffff" maxlength="7">
<input type="text" id="color3" placeholder="#ffffff" maxlength="7">
</div>
<div class="info column">
<input type="text" id="color4" placeholder="#ffffff" maxlength="7">
<input type="text" id="color5" placeholder="#ffffff" maxlength="7">
<button>Random</button>
</div>
</ul>
<ul class="listitem">
<h2 class="header" id="preview">
⏭️ Preview & Export
</h2>
<div class="info">
<iframe id="iframe" class="iframe" width="480px" height="280px"></iframe>
</div>
</ul>
</li>
</div>
<script>
const accordionList = document.querySelectorAll('.listitem');
const headers = document.querySelectorAll('.header');
function toggleAccordion() {
const thisItem = this.parentNode;
accordionList.forEach(listItem => {
if (listItem == thisItem) {
listItem.classList.toggle('open');
return;
}
listItem.classList.remove('open');
});
}
headers.forEach(header => header.addEventListener('click', toggleAccordion));
function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
const randomColor = "#" + Math.floor(Math.random() * 16777215).toString(16);
function randomConfig() {
const speedInput = document.getElementById("speed");
const sizeInput = document.getElementById("size");
const colorInputs = [
document.getElementById("color1"),
document.getElementById("color2"),
document.getElementById("color3"),
document.getElementById("color4"),
document.getElementById("color5")
];
speedInput.value = getRandomNumber(1, 100);
sizeInput.value = getRandomNumber(6, 70);
for (let i = 0; i < colorInputs.length; i++) {
colorInputs[i].value = "#" + Math.floor(Math.random() * 16777215).toString(16);
}
}
const randomButton = document.querySelector(".info button");
randomButton.addEventListener("click", randomConfig);
randomConfig();
function userConfig() {
const speedInput = document.getElementById("speed");
const sizeInput = document.getElementById("size");
const speedValue = speedInput.value;
const sizeValue = sizeInput.value;
const colorInputs = [
document.getElementById("color1"),
document.getElementById("color2"),
document.getElementById("color3"),
document.getElementById("color4"),
document.getElementById("color5")
];
const colorValues = colorInputs
.map(input => input.value)
.filter(value => value !== '');
const userPixels = JSON.stringify(colorValues);
const userColumns = sizeValue;
const userSpeed = speedValue;
return `let userPixels = ${userPixels};\nlet userColumns = ${userColumns};\nlet userSpeed = ${userSpeed};\nlet userStroke = 1;\nlet grid = [];`;
}
const previewView = document.getElementById("preview");
previewView.addEventListener("click", function() {
const middleTags = userConfig();
const openingTags64 = "PGh0bWw+PGhlYWQ+PG1ldGEgY2hhcnNldD0idXRmLTgiPjxzdHlsZT5ib2R5e21hcmdpbjowO308L3N0eWxlPjwvaGVhZD48Ym9keT48ZGl2IGlkPSJzY2VuZSI+PC9kaXY+PHNjcmlwdD4=";
const closingTags64 = "PC9zY3JpcHQ+PHNjcmlwdD50ZD0nSDRzSUFDcEZsbVFDQTgxVlVVL2JNQkIrNTFlYzlvSXpzaXdVcXFFVkpxRnFqQWNtSVhXSUI4YURpWjNHYTJwbnRrTkpwLzczbmUwa3BHSmowNlJwcTlMazRueDMvdTd6blozWE1yTkNTY2p6a2xvK3BXVjVSN1BGaUVUd2JRY2dVOUpZcU1aVHhUaWN0S0RFV0gybTFmTHFp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ZmZsYXRlUyxwNVMsZmZDU10uam9pbigiO1xuIik7CmRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQobmV3Uyk7fSkoKTsKPC9zY3JpcHQ+";
const openingTags = `<style>body{margin:0;}</style><div id="scene"></div><script>`
const closingTags = atob(closingTags64);
const finalHTML = openingTags + middleTags + closingTags;
finalHTML64 = btoa(finalHTML);
const canvasDiv = document.getElementById('iframe');
const decodedHTML = atob(finalHTML64);
const contentType = "text/html";
canvasDiv.src = "data:text/html;base64," + finalHTML64;
});
</script>
</body>
</html>