83 lines
No EOL
1.8 KiB
HTML
83 lines
No EOL
1.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Tuto Riichi</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: hidden;
|
|
background: #f0f0f0;
|
|
}
|
|
|
|
#menu {
|
|
position: relative;
|
|
z-index: 10;
|
|
}
|
|
|
|
#tile-rain {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.falling-tile {
|
|
position: absolute;
|
|
top: -100px;
|
|
animation: fall linear forwards;
|
|
}
|
|
|
|
@keyframes fall {
|
|
to {
|
|
transform: translateY(100vh) rotate(360deg);
|
|
opacity: 0;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="menu"></div>
|
|
<div id="tile-container"></div>
|
|
<div id="tile-rain"></div>
|
|
|
|
<script>
|
|
// Charger le menu
|
|
fetch('components/menu.html')
|
|
.then(r => r.text())
|
|
.then(html => document.getElementById('menu').innerHTML = html);
|
|
|
|
let allTiles = [];
|
|
|
|
// Récupérer les tuiles
|
|
fetch('http://localhost:5000/api/tiles')
|
|
.then(r => r.json())
|
|
.then(data => {
|
|
allTiles = data.tiles;
|
|
|
|
// Lancer la pluie de tuiles
|
|
startTileRain();
|
|
});
|
|
|
|
function startTileRain() {
|
|
const container = document.getElementById('tile-rain');
|
|
setInterval(() => {
|
|
const randomTile = allTiles[Math.floor(Math.random() * allTiles.length)];
|
|
const tileElem = document.createElement('div');
|
|
tileElem.className = 'falling-tile';
|
|
tileElem.innerHTML = randomTile.svg;
|
|
tileElem.style.left = Math.random() * window.innerWidth + 'px';
|
|
const duration = 3 + Math.random() * 2;
|
|
tileElem.style.animationDuration = duration + 's';
|
|
container.appendChild(tileElem);
|
|
|
|
setTimeout(() => tileElem.remove(), duration * 1000);
|
|
}, 300);
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html> |