Last active
September 20, 2022 07:52
-
-
Save kissge/c7ad56abced5eb252858f376db2554ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Loop Background with BGM</title> | |
<style> | |
html, | |
body { | |
margin: 0; | |
padding: 0; | |
background: white; | |
font-family: Helvetica, 'Hiragino Sans W2', sans-serif; | |
font-weight: lighter; | |
} | |
div { | |
width: 100vw; | |
height: 100vh; | |
position: relative; | |
overflow: hidden; | |
} | |
canvas { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
width: max(100vw, (16 / 9) * 100vh) !important; | |
height: max(100vh, (9 / 16) * 100vw) !important; | |
opacity: 0.8; | |
} | |
section { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
color: white; | |
text-shadow: 0 0 1.5em #000; | |
width: auto; | |
} | |
section * { | |
margin: 0; | |
white-space: nowrap; | |
} | |
section h1 { | |
font-family: Helvetica, 'Hiragino Sans W5', sans-serif; | |
font-size: 8vw; | |
font-weight: bold; | |
margin-left: -0.09em; | |
} | |
section h2 { | |
font-family: Helvetica, 'Hiragino Sans W5', sans-serif; | |
font-size: 3vw; | |
font-weight: bold; | |
display: inline-block; | |
margin-right: 0.6em; | |
} | |
section p { | |
font-size: 3vw; | |
display: inline-block; | |
} | |
section p::before { | |
content: '|'; | |
font-weight: bold; | |
font-size: 2em; | |
vertical-align: middle; | |
padding-right: 0.2em; | |
} | |
iframe { | |
width: 0; | |
height: 0; | |
border: 0; | |
position: absolute; | |
} | |
</style> | |
</head> | |
<body style="display: none"> | |
<div id="p5-container"></div> | |
<section> | |
<h1 contenteditable spellcheck="false">Header Text</h1> | |
<h2 contenteditable spellcheck="false">Subheader Text</h2> | |
<p contenteditable spellcheck="false">17:00  –17:30</p> | |
</section> | |
<iframe src="https://www.youtube.com/embed/FXmU9DQuILA?autoplay=1" allow="autoplay"></iframe> | |
<script type="module"> | |
// @ts-check | |
// @ts-expect-error | |
import p5 from 'https://cdn.skypack.dev/p5'; | |
for (const [key, value] of new URLSearchParams(window.location.search)) { | |
const element = document.querySelector(key); | |
if (element) { | |
element.textContent = value; | |
} | |
} | |
new p5((/** @type {import('p5')} */ p) => { | |
const grid = 360; | |
const gf = 0.9; | |
const icons = [ | |
'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNzkuNTEgNTMuNjkiPjxkZWZzPjxzdHlsZT4uY2xzLTF7ZmlsbDojNDM1MzhmO3N0cm9rZTojZmZmO3N0cm9rZS1taXRlcmxpbWl0OjEwO3N0cm9rZS13aWR0aDo0cHg7fTwvc3R5bGU+PHN5bWJvbCBpZD0iTmV3X1N5bWJvbF81IiBkYXRhLW5hbWU9Ik5ldyBTeW1ib2wgNSIgdmlld0JveD0iMCAwIDE0MS4zNCA5NS4zMyI+PHBvbHlnb24gY2xhc3M9ImNscy0xIiBwb2ludHM9IjIuODYgOTIuNzQgMi44NiAxMi45OSA4LjYgMiA0My4wOSAyIDQ4Ljg0IDEyLjE1IDExMy4wMyAxMi4xNSAxMTMuMDMgOTIuNzQgMi44NiA5Mi43NCIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMSIgcG9pbnRzPSIxMTMuMDMgOTMuMzMgMi44NiA5My4zMyAyOC4zMSAyMy40IDEzOC40OSAyMy40IDExMy4wMyA5My4zMyIvPjwvc3ltYm9sPjwvZGVmcz48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iTGF5ZXJfMS0yIiBkYXRhLW5hbWU9IkxheW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gY2xhc3M9ImNscy01IiB4PSIzNi40MyIgeT0iMCI+ajwvdHNwYW4+PHRzcGFuIGNsYXNzPSJjbHMtOCIgeD0iNDcuNzgiIHk9IjAiPnAvPC90c3Bhbj48L3RleHQ+PC9nPjwvZz48L3N2Zz4=', | |
].map((str) => p.loadImage('data:image/svg+xml;base64,' + str)); | |
const iconRatios = [ | |
Math.sqrt(150 / 222), | |
Math.sqrt(150 / 121), | |
Math.sqrt(150 / 124), | |
Math.sqrt(150 / 132), | |
Math.sqrt(150 / 192), | |
]; | |
p.setup = () => { | |
p.createCanvas(5000, (5000 * 9) / 16); | |
}; | |
p.draw = () => { | |
p.background(67, 83, 143); | |
p.stroke(255); | |
const d = p.frameCount; | |
const dg = Math.floor(d / grid); | |
p.translate(-d, -d); | |
p.strokeWeight(5); | |
for (let x = dg - 1; x < dg + 2 + p.width / grid; ++x) { | |
for (let y = dg - 1; y < dg + 2 + p.height / grid; ++y) { | |
const ox = p.noise(x, y, 1) * grid * gf; | |
const oy = p.noise(x, y, 2) * grid * gf; | |
const connectLeft = p.noise(x, y, 4) > 0.35; | |
const connectTop = p.noise(x, y, 5) > 0.35; | |
const connectLT = y % 2 === 0 && p.noise(x, y, 6) > 0.5; | |
const connectRT = y % 2 === 1 && p.noise(x, y, 6) > 0.5; | |
if (connectLeft) { | |
const lox = p.noise(x - 1, y, 1) * grid * gf; | |
const loy = p.noise(x - 1, y, 2) * grid * gf; | |
p.line( | |
x * grid + ox + (y % 2 ? grid / 2 : 0), | |
y * grid + oy, | |
(x - 1) * grid + lox + (y % 2 ? grid / 2 : 0), | |
y * grid + loy, | |
); | |
} | |
if (connectTop) { | |
const tox = p.noise(x, y - 1, 1) * grid * gf; | |
const toy = p.noise(x, y - 1, 2) * grid * gf; | |
p.line( | |
x * grid + ox + (y % 2 ? grid / 2 : 0), | |
y * grid + oy, | |
x * grid + tox + ((y - 1) % 2 ? grid / 2 : 0), | |
(y - 1) * grid + toy, | |
); | |
} | |
if (connectLT) { | |
const ltox = p.noise(x - 1, y - 1, 1) * grid * gf; | |
const ltoy = p.noise(x - 1, y - 1, 2) * grid * gf; | |
p.line( | |
x * grid + ox + (y % 2 ? grid / 2 : 0), | |
y * grid + oy, | |
(x - 1) * grid + ltox + ((y - 1) % 2 ? grid / 2 : 0), | |
(y - 1) * grid + ltoy, | |
); | |
} | |
if (connectRT) { | |
const rtox = p.noise(x + 1, y - 1, 1) * grid * gf; | |
const rtoy = p.noise(x + 1, y - 1, 2) * grid * gf; | |
p.line( | |
x * grid + ox + (y % 2 ? grid / 2 : 0), | |
y * grid + oy, | |
(x + 1) * grid + rtox + ((y - 1) % 2 ? grid / 2 : 0), | |
(y - 1) * grid + rtoy, | |
); | |
} | |
} | |
} | |
for (let x = dg - 1; x < dg + 2 + p.width / grid; ++x) { | |
for (let y = dg - 1; y < dg + 2 + p.height / grid; ++y) { | |
const ox = p.noise(x, y, 1) * grid * gf; | |
const oy = p.noise(x, y, 2) * grid * gf; | |
const i = Math.floor(p.noise(x, y, 3) * icons.length * icons.length) % icons.length; | |
p.image( | |
icons[i], | |
x * grid + ox + (y % 2 ? grid / 2 : 0) - 80, | |
y * grid + oy - 80, | |
160 / iconRatios[i], | |
160 * iconRatios[i], | |
); | |
} | |
} | |
}; | |
}, 'p5-container'); | |
document.body.style.display = ''; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment