Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vtbag/website. The @vtbag website. ⭐️ Please star to support this work! ⭐️
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135<html> <head> <script is:inline> addEventListener("pageswap", () => { console.log("pageswap"); }); addEventListener("DOMContentLoaded", () => { console.log("DomContentLoaded"); if ("onpagereveal" in window) return; shuffle(); });
addEventListener("pagereveal", (event) => { shuffle(); addViewTransitionNames(); });
function shuffle() { const list = shuffleArray([ "a", "b", "c", "d", "e", "f", "g", "h", "i", ]); document.querySelector("ul").innerHTML = createList(list); }
function addViewTransitionNames() { document.querySelectorAll("li").forEach((i) => { i.style.viewTransitionName = i.innerText.replaceAll(" ", "-"); }); }
function shuffleArray(array /*: string[]*/) { const newArray = [...array]; for (let i = newArray.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [newArray[i], newArray[j]] = [newArray[j] /*!*/, newArray[i] /*!*/]; } return newArray; } function createList(items /*: string[]*/) { return items.map((item) => `<li>${item}</li>`).join(""); } </script> </head> <body> <div class="container"> <div class="back"> <ul> <li>a</li> <li>b</li> <li>c</li> <li>d</li> <li>e</li> <li>f</li> <li>g</li> <li>h</li> <li>i</li> </ul> </div> <div class="front"> <ul></ul> <a href=".">navigate --></a> </div> </div></body > <style is:global> * { box-sizing: border-box; } .container { position: relative; margin-inline: auto; width: 500px; height: 500px; } .back, .front { background-color: rgb(120, 88, 55); position: absolute; top: 0; height: 100%; width: 100%; } .front { mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect width="100%" height="100%" fill="white" /><rect x="15" y="15" width="400" height="300" fill="black" /></svg>'); mask-mode: luminance; view-transition-name: front; } :root, body { margin: 0; height: 100cqh; } @media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } } ::view-transition-group(*) { animation-duration: 2s; } ::view-transition-new(*) { animation: none; }
:root { color-scheme: dark; background-color: #123; }
main { padding: 1em; position: relative; } ul { height: 300px; width: 400px; margin: 16px; border: 1px dashed; overflow: visible; } li, a { font-size: 36px; } </style></html>