diff --git a/public/assets/css/wrongplace.css b/public/assets/css/wrongplace.css index 9c9c0ff..fc8e5d6 100644 --- a/public/assets/css/wrongplace.css +++ b/public/assets/css/wrongplace.css @@ -7,10 +7,32 @@ body { align-content: center; justify-content: center; user-select: none; + overflow: hidden; } img { width: clamp(20px, 50vh, 80vw); image-rendering: pixelated; pointer-events: none; +} + +#pattern { + position: fixed; + inset: 0; + width: 100%; + height: 100%; + z-index: -1; +} + +#pattern p { + margin: 0; + display: flex; + justify-content: space-between; +} + +#pattern p span { + font-size: clamp(10px, 4vh, 10vw); + font-family: monospace; + font-weight: bold; + color: black; } \ No newline at end of file diff --git a/public/assets/js/WrongPlace.mjs b/public/assets/js/WrongPlace.mjs new file mode 100644 index 0000000..b33d198 --- /dev/null +++ b/public/assets/js/WrongPlace.mjs @@ -0,0 +1,41 @@ +export default class WrongPlace { + constructor(target) { + const interval = 2000; + + this.target = target; + this.populate(); + + this.anim = setInterval(() => this.generate(), interval); + this.generate(); + } + + populate() { + const y = 30; + const x = 27; + + // Add vertical paragraphs and horizontal spans, man + for (let i = 0; i <= y; i++) { + const p = document.createElement("p"); + for (let j = 0; j <= x; j++) { + const span = document.createElement("span"); + p.appendChild(span); + } + this.target.appendChild(p); + } + } + + // Get a random number, man + rand() { + const clamp = [0, 100] + return Math.floor(Math.random() * (clamp[1] - clamp[0] + 1) + clamp[0]); + } + + // Generate a new random background, man + generate() { + const spans = this.target.getElementsByTagName("span"); + + for (const span of spans) { + span.innerText = this.rand(); + } + } +} \ No newline at end of file diff --git a/public/error.html b/public/error.html index f607136..f63e24c 100755 --- a/public/error.html +++ b/public/error.html @@ -17,5 +17,12 @@