131 lines
No EOL
3.2 KiB
HTML
131 lines
No EOL
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Tuto Riichi</title>
|
|
<link rel="stylesheet" href="/frontend/css/style.css">
|
|
<link rel="stylesheet" href="/frontend/css/speech-bubble.css">
|
|
<style>
|
|
#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(var(--rotation));
|
|
opacity: 0;
|
|
}
|
|
}
|
|
|
|
#mascotte {
|
|
position: relative;
|
|
bottom: -0px;
|
|
right: 0px;
|
|
z-index: 999;
|
|
transform: scaleX(-1);
|
|
cursor: pointer;
|
|
}
|
|
|
|
#mascotte img {
|
|
width: 250px;
|
|
height: auto;
|
|
display: block;
|
|
}
|
|
|
|
.speech-bubble {
|
|
position: relative;
|
|
bottom: 0px;
|
|
left: 700px;
|
|
z-index: 998;
|
|
display: flex;
|
|
width: 1025px;
|
|
height: 560px;
|
|
}
|
|
|
|
.speech-bubble.hidden {
|
|
display: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="menu"></div>
|
|
<div id="tile-container"></div>
|
|
<div id="tile-rain"></div>
|
|
<div class="speech-bubble">
|
|
<div class="speech-text" id="speech-text"></div>
|
|
</div>
|
|
<div id="mascotte"></div>
|
|
|
|
<script src="/frontend/js/fr/texts.js"></script>
|
|
<script>
|
|
// Charger le menu
|
|
fetch('/components/menu.html')
|
|
.then(r => r.text())
|
|
.then(html => document.getElementById('menu').innerHTML = html);
|
|
|
|
// Afficher la mascotte
|
|
const mascolteEl = document.getElementById('mascotte');
|
|
mascolteEl.innerHTML = '<img src="/img/tilineau/speaking.png" alt="Tilineau">';
|
|
|
|
// Afficher le texte de bienvenue
|
|
document.getElementById('speech-text').innerHTML = texts.homePage.welcome;
|
|
|
|
// Toggle bulle de dialogue au clic sur la mascotte
|
|
const speechBubble = document.querySelector('.speech-bubble');
|
|
mascolteEl.addEventListener('click', () => {
|
|
speechBubble.classList.toggle('hidden');
|
|
});
|
|
|
|
let allTiles = [];
|
|
|
|
// Récupérer les tuiles
|
|
fetch('/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 = 8 + Math.random() * 2;
|
|
tileElem.style.animationDuration = duration + 's';
|
|
|
|
// Rotation aléatoire à droite ou à gauche
|
|
const rotation = Math.random() * 720 - 360;
|
|
const direction = Math.random() > 0.5 ? 1 : -1;
|
|
tileElem.style.setProperty('--rotation', (rotation * direction) + 'deg');
|
|
|
|
container.appendChild(tileElem);
|
|
|
|
setTimeout(() => tileElem.remove(), duration * 1000);
|
|
}, 300);
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html> |