Document the L'Anneau identity and version its reference page (#81)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit was merged in pull request #90.
This commit is contained in:
1 parent
8784c6eb6c
commit
d42125724e
3 files changed
+730
-6
No files matched your search
+32
-5
@@ -6,13 +6,15 @@ Entre deux Parties, le joueur veut repérer les champions avec lesquels il lui m
|
||||
|
||||
L’accueil et la sélection doivent donner la réponse avec les mêmes cartes de champion. Une page « Statistiques » accueille l’analyse détaillée. La référence visuelle est la maquette validée, avec ses portraits verticaux allongés, son compteur discret et son trait de progression fin. L’interface reste en français et garde sa propre identité visuelle. [Ouvrir la maquette interactive](prototype-interface.html)
|
||||
|
||||
L’identité « L’Anneau » (itération « La Bannière ») habille ensuite cette refonte : les couleurs du logo, une bannière illustrée et des animations déclenchées par les événements du jeu. Sa référence visuelle est une seconde page interactive, à ouvrir avec une connexion pour les illustrations. [Ouvrir la référence de l’identité](prototype-identite.html)
|
||||
|
||||
## Critères d’acceptation
|
||||
|
||||
### Accueil et tri
|
||||
|
||||
1. À chaque ouverture, « Tous » est sélectionné. La grille présente tous les champions, y compris ceux jamais joués et ceux déjà validés. La recherche par nom et les filtres « Restants » et « Validés » permettent de réduire la grille.
|
||||
2. À côté du titre, une seule ligne de texte indique le nombre de champions validés sur le total du Défi de la saison. Un trait fin sous le compteur matérialise la progression. Le total reste celui du Défi quand on recherche un champion, filtre la grille ou passe en sélection.
|
||||
3. Lorsqu’aucune préférence de tri n’a encore été enregistrée, les champions sont classés par points de maîtrise décroissants. Le joueur peut choisir A–Z. Le même choix s’applique aux deux écrans et à leurs différentes sections, puis à la prochaine ouverture.
|
||||
2. La bannière ouvre l’accueil. Elle porte l’anneau, un titre-compteur « N / total champions validés » surmonté de la Saison, et deux lignes : « Dernier champion validé : X, le … » et « Dernière Partie : … ». La seconde est permanente : elle se calcule à partir des Parties enregistrées, pas des seules Parties suivies pendant la session. Le titre « Défi de saison » disparaît. Le total reste celui du Défi quand on recherche un champion, filtre la grille ou passe en sélection. La section « Identité » décrit la bannière et l’anneau.
|
||||
3. Lorsqu’aucune préférence de tri n’a encore été enregistrée, les champions sont classés par points de maîtrise décroissants. Le joueur peut choisir A–Z. Le même choix s’applique aux deux écrans et à toutes leurs sections de cartes, puis à la prochaine ouverture. L’anneau n’est pas une section de cartes : c’est une jauge à l’ordre fixe, qui ne suit pas le tri choisi.
|
||||
|
||||
### Carte de champion
|
||||
|
||||
@@ -27,15 +29,39 @@ Les trois marques portent sur le Défi d’un Compte pour une Saison, tous Forma
|
||||
|
||||
Une seule Partie peut donner les trois marques. Une 2ᵉ place en Arena 3×6 donne la coche « Victoire » et laisse le champion dans « Restants ».
|
||||
|
||||
Au survol ou au focus clavier, la fiche du champion affiche ses Parties, ses Victoires, son meilleur Placement, ses Tentatives et ses points de maîtrise. Pour un champion validé, elle affiche aussi **la date du premier top 1 de la saison**. Un top 1 ultérieur conserve cette date. Les Tentatives s’arrêtent à la Partie de validation incluse.
|
||||
Au survol ou au focus clavier, la fiche du champion apparaît en glissant sur le bas de la carte et affiche ses Parties, ses Victoires, son meilleur Placement, ses Tentatives et ses points de maîtrise. Pour un champion validé, elle affiche aussi **la date du premier top 1 de la saison**. Un top 1 ultérieur conserve cette date. Les Tentatives s’arrêtent à la Partie de validation incluse.
|
||||
|
||||
### Pendant la sélection Arena
|
||||
|
||||
1. La détection d’une sélection Arena affiche automatiquement la rangée de cartes dans la fenêtre existante, sous la progression de saison. Le joueur garde le focus dans League : une fenêtre réduite ou cachée dans la zone de notification se rouvre à l’entrée en sélection, sans prendre le focus, et reste ouverte à la fin de la sélection. Ce comportement n’a pas de réglage.
|
||||
1. La détection d’une sélection Arena affiche automatiquement la rangée de cartes dans la fenêtre existante, sous la bannière de sélection. Le joueur garde le focus dans League : une fenêtre réduite ou cachée dans la zone de notification se rouvre à l’entrée en sélection, sans prendre le focus, et reste ouverte à la fin de la sélection. Ce comportement n’a pas de réglage.
|
||||
2. La rangée « Champions de l’Enclume » contient **tous** les champions marqués d’une enclume dans la sélection en cours, dans le tri choisi. Au-dessous, « Autres champions » est replié par défaut. L’ouvrir affiche tous les champions sans enclume, avec le même tri et les mêmes cartes. Sa recherche par nom filtre uniquement cette section.
|
||||
3. Dans les deux sections, les cartes gardent leur place lorsqu’un champion est validé, banni ou pris par un allié. Son portrait est grisé et la carte indique les raisons applicables : « Validé », « Banni », « Pris par un allié », et « Indisponible » pour un champion que le client ne propose pas (non possédé ou désactivé). Un champion validé et banni porte les deux indications.
|
||||
4. Une présélection alliée laisse la carte dans son état courant. « Pris par un allié » apparaît à la confirmation du choix. Les bans et les choix alliés expirent avec la sélection : ils n’affectent ni les coches personnelles, ni le compteur du Défi, ni la sélection suivante.
|
||||
|
||||
### Identité
|
||||
|
||||
Cette section décrit l’identité « L’Anneau ». [La page de référence](prototype-identite.html) la montre : l’accueil, une Partie au hasard, un top 1, la sélection, le thème clair et « Statistiques ». C’est une maquette : elle ne montre pas toute la spécification (l’animation différée, par exemple), et en cas d’écart cette section prévaut. Les critères ci-dessus restent valables ; l’identité ne change ni les données, ni les marques, ni le vocabulaire. On dit « validé » et « Premier top 1 », jamais « sacre ».
|
||||
|
||||
**Couleurs.** Celles du logo, un anneau doré autour d’un disque bleu nuit, dans toute l’appli. En sombre, les neutres sont des bleus nuit ; en clair, un papier froid. L’accent est doré dans les deux thèmes, avec une encre dorée plus foncée en clair pour rester lisible. Le texte posé sur une illustration reste clair dans les deux thèmes. La préférence de thème ne change pas. Les valeurs sont celles de la page de référence.
|
||||
|
||||
**Police.** Unbounded est embarquée et réservée au nom de l’appli, aux titres et au compteur. Tout le reste reste en Inter.
|
||||
|
||||
**Bannière d’accueil.** Un surtitre (la Saison), un titre-compteur, les deux lignes du critère 2 et l’anneau, sur l’illustration du dernier champion validé. Sans champion validé, la première ligne devient « Aucun champion validé pour l’instant. ».
|
||||
|
||||
**Bannière de sélection.** Elle prend la place de celle de l’accueil pendant une sélection Arena. Son surtitre porte le compteur, son titre est « Sélection des champions », et sa ligne indique « Champions de l’Enclume · k à valider et disponibles ». Seules les graduations des Champions de l’Enclume y restent vives. L’illustration suit la carte survolée ; au repos, c’est celle du premier Champion de l’Enclume à valider et disponible. La barre du haut n’affiche aucun indicateur de sélection.
|
||||
|
||||
**Anneau.** Une graduation par champion du Défi, dans un ordre fixe : d’abord les validés, dans l’ordre de leur Premier top 1 en tournant depuis midi, puis les champions joués, puis ceux jamais joués, ces deux derniers groupes par points de maîtrise décroissants (A–Z tant que les points sont inconnus, comme les cartes). Il ne suit pas le tri choisi.
|
||||
|
||||
**Illustration.** La bannière montre une fenêtre d’environ 80 % de la largeur du splash du champion, centrée sur lui (voir les décisions d’implémentation pour le cadrage). Elle passe d’une illustration à l’autre par un fondu.
|
||||
|
||||
**Animations.** Elles sont toujours déclenchées par un événement et ne dessinent rien au repos. Elles suivent le réglage Windows « Afficher les animations » ; l’appli n’a pas de réglage « Animations ».
|
||||
|
||||
- Fin d’une Partie suivie en direct. Un top 1 déclenche la comète, la bannière et « Validé ». Une nouvelle Marque fait monter la graduation d’un cran et remplit la coche. Sinon, la graduation clignote et la ligne « Dernière Partie » apparaît en fondu. L’animation est différée jusqu’à ce que « Défi » soit visible, elle ne joue que la plus forte des Parties terminées entre-temps, et elle est abandonnée si une sélection commence. Les Parties importées ou lues dans l’historique n’animent rien.
|
||||
- Entrée en sélection : balayage, titre, cartes distribuées. Sortie : les cartes se retirent.
|
||||
- Transitions entre « Défi » et « Statistiques » : un fondu avec un léger glissement.
|
||||
- Survol : le même sur toutes les cartes. Le voile sur les cartes voisines ne s’applique que dans la main de la sélection.
|
||||
- Limites de GPUI, sans le modifier (ADR-0004) : pas de rotation, pas d’espacement des lettres animé, une montée de la carte au lieu d’un grossissement, un voile au lieu d’un filtre.
|
||||
|
||||
### Page « Statistiques »
|
||||
|
||||
Pour une Saison, présenter d’abord la courbe cumulée des champions validés, puis la répartition des Placements et les Tentatives nécessaires pour valider un champion. Réutiliser les statistiques existantes et conserver la consultation par Compte, Saison et Format. Dans « Toutes les Saisons », seules les statistiques qui ont un sens sur cette période s’appliquent. Le Défi reste propre à une Saison.
|
||||
@@ -44,6 +70,7 @@ Pour une Saison, présenter d’abord la courbe cumulée des champions validés,
|
||||
|
||||
- L’application cible reste l’application Windows native en GPUI via gpui-kit. L’accueil et la sélection réutilisent une seule représentation de carte. La logique de progression provient des Parties enregistrées, y compris pour les données antérieures à la refonte. La Progression officielle sert au contrôle du total.
|
||||
- Le calcul du Défi détermine déjà la première Partie de Placement 1 par ordre chronologique. Exposer sa date à la fiche du champion et employer la même convention de date que la courbe de progression. Les marques saisonnières restent indépendantes du filtre de Format des statistiques.
|
||||
- Les splashs sont tous téléchargés en arrière-plan, à basse priorité, après les portraits de cartes, et gardés sur disque. Aucune illustration Riot n’entre dans le dépôt : la page de référence les charge depuis Data Dragon. Le cœur calcule le cadrage de chaque champion au téléchargement, en retrouvant l’art de chargement (le portrait vertical des cartes) dans le splash, et en garde le point de focus. Si la correspondance est douteuse, ou si le splash manque, il revient à un cadrage fixe, le même pour tous. Les valeurs de la page de référence viennent de ce calcul et de son repli. Deux splashs au plus sont décodés à la fois : celui qui s’affiche et celui qui le remplace.
|
||||
- Conserver le comportement existant de la recherche de champions, des préférences et du suivi de Compte. Le client League reste une source en lecture seule. Les données de sélection sont temporaires : leur disparition laisse l’historique enregistré consultable.
|
||||
- Réutiliser le suivi de sélection Arena livré avec le ticket #13. Il lit déjà les Champions de l’Enclume, les bans et les choix alliés, puis regroupe les champions exclus pour déterminer lesquels sont disponibles. Transmettre à la carte le motif précis du grisé et actualiser son libellé lorsque ce motif change.
|
||||
- Respecter les budgets existants : réagir aux événements du client, limiter le travail aux portraits affichés, garder les chargements en arrière-plan à basse priorité. Le survol d’une carte doit pouvoir afficher ses données sans relire l’historique ni recalculer les graphiques. Le benchmark complet relève du contrôle de version majeure. [Budgets et méthode de mesure](performance.md)
|
||||
@@ -73,4 +100,4 @@ Ces replis sont des propositions de développement. La maquette illustre les ét
|
||||
|
||||
## Hors périmètre
|
||||
|
||||
Les nouveaux indicateurs statistiques feront l’objet d’un autre ticket. La Renommée, les actions de sélection ou de ban dans League et le bouton « Simuler la sélection » de la maquette sont exclus de la version native.
|
||||
Les nouveaux indicateurs statistiques feront l’objet d’un autre ticket. Les itérations « Le Hublot » et « Les Médailles » de l’identité ne sont pas retenues, et aucune illustration Riot n’entre dans le dépôt. La Renommée, les actions de sélection ou de ban dans League et le bouton « Simuler la sélection » de la maquette sont exclus de la version native.
|
||||
+9
-1
@@ -35,8 +35,16 @@ Budgets are checked by a **full benchmark before each major release** (X.0.0; ot
|
||||
|
||||
- **Window moves and idle CPU**: `powershell.exe -ExecutionPolicy Bypass -File scripts/move-probe.ps1 -Title "Arena Tracker"` from WSL, with the app open. It moves the window 240 times per second without touching the mouse, after an idle phase. `MOVE block` is the time each move holds the UI thread, close to the cost of the frame it causes; `IDLE cpu` is budget 2. Compare with File Explorer with `-Class CabinetWClass`. A real title-bar drag (Windows' modal move loop) is not covered: check it by hand.
|
||||
- **Champion table hover**: `powershell.exe -ExecutionPolicy Bypass -File scripts/hover-probe.ps1 -Title "Arena Tracker"` from WSL, with the « Statistiques » tab showing the table under the default band (adjust `-Top` and `-Bottom` otherwise). The app opens on « Défi »: open « Statistiques » first, as the band targets its table. After an idle phase, it posts synthetic mouse moves across table rows 240 times per second without touching the real cursor. Compare `HOVER cpu` with `IDLE cpu`; `HOVER ping` shows how long input waits behind the UI thread while hovering (budget 1). The default band is `-X 0.25 -Top 0.62 -Bottom 0.95 -Step 0.04` (fractions of the client area, about one row per move in a window at least 800 px tall). Leave the real cursor still over the window, outside the table: when it is outside the window, GPUI sees each synthetic move as the mouse entering then leaving, and refreshes the whole window, bypassing cached views.
|
||||
- **Where a frame goes**: build with `scripts/prod build --features profile` (never for everyday use) and start the app with `ARENA_TRACKER_PROFILE=<file.csv>` (from WSL, pass it through `WSLENV`, e.g. `WSLENV=ARENA_TRACKER_PROFILE/p:ARENA_TRACKER_HIDE`). Every second it appends the frames GPUI drew (`draw`: total, `request_layout`, `prepaint`, `paint` in ms), their presentation (`present`) and the views' own time (`view`, recorded by GPUI from 0.5 ms). `ARENA_TRACKER_HIDE=<parts>`, read at start, removes parts of the page so that a part's cost is the difference with the full page under the hover probe: `header`, `banners` (both tabs), then for « Statistiques » `tiles`, `placements`, `completed`, `attempts` (the three charts keep their height), `tabs`, `table`, and for « Défi » `home-header` (Season, title and counter), `home-tools` (the heading row: title, count, filters and search), `cards` (the card grid), and during an Arena champ select `anvil` (the Anvil champions heading and row, which take the place of `home-tools` and `cards`), then `others` (the « Autres champions » section: its header and, when open, its search and grid).
|
||||
- **Where a frame goes**: build with `scripts/prod build --features profile` (never for everyday use) and start the app with `ARENA_TRACKER_PROFILE=<file.csv>` (from WSL, pass it through `WSLENV`, e.g. `WSLENV=ARENA_TRACKER_PROFILE/p:ARENA_TRACKER_HIDE`). Every second it appends the frames GPUI drew (`draw`: total, `request_layout`, `prepaint`, `paint` in ms), their presentation (`present`) and the views' own time (`view`, recorded by GPUI from 0.5 ms). `ARENA_TRACKER_HIDE=<parts>`, read at start, removes parts of the page so that a part's cost is the difference with the full page under the hover probe: `header`, `banners` (both tabs), then for « Statistiques » `tiles`, `placements`, `completed`, `attempts` (the three charts keep their height), `tabs`, `table`, and for « Défi » `banner` (the banner, on the home and during a champ select: ring, Season, counter-title, its two lines and the splash; it replaces `home-header`, and is not `banners`, the status messages), `home-tools` (the heading row: title, count, filters and search), `cards` (the card grid), and during an Arena champ select `anvil` (the Anvil champions heading and row, which take the place of `home-tools` and `cards`), then `others` (the « Autres champions » section: its header and, when open, its search and grid).
|
||||
- **Memory**: working set of `arena-tracker.exe` in Task Manager, or `Get-Process arena-tracker` in PowerShell, once the page is fully loaded.
|
||||
- **CI cannot check budgets**: its runner is Linux without a GPU, and the app only builds on Windows (ADR-0003). When a change relies on cached views to stay within budget, a structural test (for example, "hovering the table does not render the charts") guards it instead of a timed test. The charts row is a cached view (#31), and « Défi » never renders it (a structural test guards that too). The home's card grid is the second (#72) and the « Autres champions » grid, while the section is open, the third: their size comes from their style, and structural tests check that hovering outside it does not render its cards and that hovering or scrolling it recomputes no statistics. Each card grid reads its portraits through its own image cache, never GPUI's app-wide one, and keeps only those of the cards it paints (#77): structural tests check that scrolling drops the others, from the GPU atlas too, and that hovering outside the grid drops none; a grid that stops being shown (the home grid under « Statistiques » or during a champ select, the Anvil champions row once it ends) gives all its portraits back. A cached view is laid out from its style alone, never its content, so only a part whose size does not depend on its content can be one. A view that is not cached renders again with its parent and saves nothing, while its state must be kept in sync; a window move bypasses every cache.
|
||||
|
||||
GPUI and gpui-component are not modified to meet a budget: the app's own rendering cost is the lever (ADR-0004).
|
||||
|
||||
### Animations and splashes
|
||||
|
||||
The identity (ring, banner, animations; `docs/interface.md`) follows the same rule:
|
||||
|
||||
- **Animations are triggered by an event** (end of a followed Match, champ select entering or leaving, card hover, tab change) and **draw nothing at rest**. No timer or loop keeps a frame going once an animation is over, and none runs while the window is hidden or minimised. They follow the Windows « Show animations » setting.
|
||||
- **Two splashes decoded at most**: the one shown and the one replacing it. All splashes are downloaded in the background, at low priority, after the card portraits, and kept on disk.
|
||||
- **The ring is a cached view**, laid out from its style alone. A structural test guards it: hovering a card, scrolling the grid or an animation on another part does not render the ring; only a change of what it shows (the champions' state, their order, the selection) or its own animation does. Its gain is checked at the next release benchmark.
|
||||
@@ -0,0 +1,689 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Arena Tracker · Identité « L'Anneau »</title>
|
||||
<!-- Référence visuelle de l'identité « L'Anneau » (itération B3, « La Bannière ») : couleurs du logo,
|
||||
anneau de progression, bannière illustrée, animations de fin de Partie, entrée en sélection et survol.
|
||||
Les animations reproduisent ce que GPUI sait faire : ni rotation, ni mise à l'échelle d'un élément,
|
||||
ni espacement des lettres animé ; un voile plutôt qu'un filtre sur les cartes voisines.
|
||||
Saison fictive (graine fixe). Illustrations chargées depuis Data Dragon : il faut une connexion. -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Unbounded:wght@600;800&display=swap">
|
||||
<style>
|
||||
/* Les couleurs du logo : anneau doré autour d'un disque bleu nuit. Sombre d'abord, clair en papier froid.
|
||||
Le texte posé sur une illustration reste clair dans les deux thèmes. */
|
||||
:root {
|
||||
--bg: #11152a; --band: #151a33; --surface: #181e38; --raised: #20274a; --line: #283053;
|
||||
--fg: #edeaf7; --muted: #8b91b1; --faint: #3a4166;
|
||||
--gold: #f5b83d; --gold-ink: #f5b83d; --gold-soft: rgba(245, 184, 61, .34); --gold-glow: rgba(245, 184, 61, .55);
|
||||
--on-gold: #161b2e; --ban: #ff7a7a;
|
||||
--art-ink: #ffffff; --art-soft: rgba(255, 255, 255, .74); --art-shade: rgba(9, 11, 24, .94); --art-chip: rgba(17, 21, 42, .88);
|
||||
--display: Unbounded, "Segoe UI", system-ui, sans-serif;
|
||||
--body: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
|
||||
--bar-bg: #fdfd96; --bar-fg: #141414;
|
||||
color-scheme: dark;
|
||||
}
|
||||
:root[data-mode="light"] {
|
||||
--bg: #eef0f7; --band: #e5e8f3; --surface: #ffffff; --raised: #e4e8f4; --line: #d2d7e9;
|
||||
--fg: #161b2e; --muted: #596082; --faint: #c5cbe0;
|
||||
--gold: #e3a21a; --gold-ink: #8f5d00; --gold-soft: rgba(212, 146, 14, .4); --gold-glow: rgba(227, 162, 26, .45);
|
||||
--on-gold: #161b2e; --ban: #c62f2f;
|
||||
color-scheme: light;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
html, body { min-height: 100%; }
|
||||
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--body); transition: background-color .3s; }
|
||||
button, input, select { font: inherit; color: inherit; }
|
||||
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
|
||||
[hidden] { display: none !important; }
|
||||
|
||||
.frame { max-width: 1264px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 150px; }
|
||||
.top { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; min-height: 64px; border-bottom: 1px solid var(--line); }
|
||||
.brand { display: flex; align-items: center; gap: 10px; font: 600 16px/1 var(--display); letter-spacing: -.02em; white-space: nowrap; }
|
||||
.brand svg { width: 28px; height: 28px; }
|
||||
.nav { display: flex; gap: 4px; }
|
||||
.nav button { font-size: 13px; font-weight: 600; color: var(--muted); padding: 7px 13px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; transition: background-color .2s, color .2s; }
|
||||
.nav button:hover:not(:disabled) { color: var(--fg); background: var(--raised); }
|
||||
.nav button[aria-current="page"] { color: var(--on-gold); background: var(--gold); }
|
||||
.nav button:disabled { opacity: .4; cursor: default; }
|
||||
.screen { padding-top: 22px; }
|
||||
.crown-ic { width: 1em; height: 1em; fill: currentColor; flex: none; }
|
||||
@keyframes fade-in { from { opacity: 0; } }
|
||||
|
||||
/* ---- Bannière : l'anneau, le texte, le splash recadré sur le champion. ---- */
|
||||
.banner { position: relative; isolation: isolate; overflow: hidden; border-radius: 16px; min-height: clamp(220px, 26vw, 310px); display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); padding: 24px clamp(16px, 3vw, 36px); background: var(--band); }
|
||||
.art-box { position: absolute; top: 0; right: 0; width: 72%; height: 100%; z-index: -2; overflow: hidden; }
|
||||
.art { position: absolute; max-width: none; opacity: 0; transition: opacity .5s ease; }
|
||||
.art.on { opacity: 1; }
|
||||
.art.settle { animation: settle 1.8s cubic-bezier(.2,.7,.2,1); }
|
||||
/* Dans l'appli : l'image est agrandie dans la bannière qui la découpe, puis revient à sa taille. */
|
||||
@keyframes settle { from { transform: scale(1.07); } }
|
||||
.grade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
|
||||
background: linear-gradient(90deg, var(--band) 30%, color-mix(in srgb, var(--band) 72%, transparent) 46%, transparent 74%),
|
||||
linear-gradient(to top, color-mix(in srgb, var(--band) 55%, transparent), transparent 45%); }
|
||||
.ring { position: relative; width: clamp(120px, 16vw, 200px); flex: none; aspect-ratio: 1; }
|
||||
.ring svg { width: 100%; height: 100%; display: block; overflow: visible; }
|
||||
.tick { stroke-linecap: round; transition: opacity .4s, stroke .2s; }
|
||||
.tick.done { stroke: var(--gold); stroke-width: 4; }
|
||||
.tick.played { stroke: var(--gold-soft); stroke-width: 3; }
|
||||
.tick.never { stroke: var(--faint); stroke-width: 3; }
|
||||
.tick.anvil { stroke-width: 7; }
|
||||
.tick.lit { stroke: var(--fg); stroke-width: 7; }
|
||||
.tick.ignite { animation: ignite 1.3s ease-out; }
|
||||
@keyframes ignite { 0% { stroke: var(--fg); stroke-width: 11; } 100% { } }
|
||||
.tick.step { animation: step 1.4s ease-out; }
|
||||
@keyframes step { 0% { stroke: var(--gold); stroke-width: 9; } 100% { } }
|
||||
.tick.blink { animation: blink .9s ease-in-out; }
|
||||
@keyframes blink { 0%, 100% { } 40% { stroke: var(--fg); stroke-width: 6; } }
|
||||
.ring.dim .tick:not(.anvil) { opacity: .16; }
|
||||
.disc { fill: var(--bg); }
|
||||
.crown { fill: var(--gold); transform-box: fill-box; transform-origin: 50% 100%; }
|
||||
.crown.bounce { animation: bounce .8s cubic-bezier(.3,1.8,.4,1); }
|
||||
@keyframes bounce { 0% { transform: scale(.6) translateY(8px); } 100% { transform: none; } }
|
||||
.comet { fill: var(--fg); }
|
||||
.trail { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round; }
|
||||
.copy { min-width: 0; max-width: 46%; }
|
||||
.kicker { font: 600 12px/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); }
|
||||
.title { margin: 8px 0 10px; font: 600 clamp(22px, 2.8vw, 34px)/1.12 var(--display); letter-spacing: -.035em; text-wrap: balance; }
|
||||
.count { display: inline-block; font-weight: 800; color: var(--gold-ink); }
|
||||
.count.roll { animation: roll .7s cubic-bezier(.2,1.4,.4,1); }
|
||||
@keyframes roll { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
|
||||
.lines { display: grid; gap: 3px; }
|
||||
.line { margin: 0; color: var(--muted); font-size: 14px; }
|
||||
.line b { color: var(--fg); font-weight: 600; }
|
||||
.line.fresh { animation: fade-in .7s ease both; }
|
||||
.stage-title.in { animation: title-in .7s cubic-bezier(.2,.8,.2,1) both; }
|
||||
/* Dans l'appli : fondu et montée, GPUI n'anime pas l'espacement des lettres. */
|
||||
@keyframes title-in { from { opacity: 0; transform: translateY(8px); } }
|
||||
@media (max-width: 680px) {
|
||||
.banner { flex-direction: column; align-items: flex-start; }
|
||||
.art-box { width: 100%; }
|
||||
.grade { background: linear-gradient(to top, var(--band) 40%, color-mix(in srgb, var(--band) 40%, transparent) 75%, transparent); }
|
||||
.copy { max-width: none; }
|
||||
}
|
||||
|
||||
/* ---- Outils et grille de l'accueil, comme dans #78. ---- */
|
||||
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 28px 0 16px; }
|
||||
.tools h2 { margin: 0 auto 0 0; font: 600 20px/1.2 var(--display); letter-spacing: -.03em; display: flex; align-items: center; gap: 8px; }
|
||||
.n { font: 550 12px var(--body); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; letter-spacing: 0; }
|
||||
.tabs { display: flex; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
|
||||
.tabs button { border: 0; background: transparent; border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
|
||||
.tabs button[aria-pressed="true"] { background: var(--raised); color: var(--fg); }
|
||||
.sort { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 4px 0 10px; }
|
||||
.sort select { border: 0; background: transparent; color: var(--fg); font-size: 12px; padding: 7px 4px; }
|
||||
.sort select option { background: var(--surface); }
|
||||
.search { width: min(100%, 240px); background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
|
||||
.search:focus { border-color: var(--gold); outline: none; }
|
||||
.empty { grid-column: 1 / -1; color: var(--muted); padding: 30px 0; }
|
||||
|
||||
/* ---- La carte : la même partout, avec le même survol. ---- */
|
||||
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
|
||||
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
|
||||
@media (max-width: 720px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
|
||||
@media (max-width: 480px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
||||
.card { position: relative; isolation: isolate; display: block; width: 100%; aspect-ratio: .68; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); text-align: left; color: var(--art-ink); cursor: default;
|
||||
transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .2s; }
|
||||
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 24%; z-index: -2; transition: transform .7s cubic-bezier(.2,.8,.2,1), filter .5s; }
|
||||
.card.dim img { filter: grayscale(1) brightness(.7); }
|
||||
.shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(to bottom, rgba(9,11,24,0) 40%, rgba(9,11,24,.35) 58%, var(--art-shade) 92%); }
|
||||
.reasons { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 3px; }
|
||||
.reason { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 650; padding: 3px 6px; border-radius: 4px; background: var(--art-chip); color: var(--art-ink); }
|
||||
.reason.gold { background: #f5b83d; color: #161b2e; }
|
||||
.reason.ban { color: #ffa0a0; }
|
||||
.reason.appear { animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
|
||||
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
|
||||
.cap { position: absolute; left: 11px; right: 8px; bottom: 10px; transition: opacity .2s, transform .3s; }
|
||||
.name { display: block; font-weight: 650; font-size: clamp(14px, 1.35vw, 18px); line-height: 1.15; letter-spacing: -.02em; }
|
||||
.marks { display: flex; gap: 4px 9px; margin-top: 6px; flex-wrap: wrap; }
|
||||
.mark { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; color: var(--art-soft); }
|
||||
.mark::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--art-soft); transition: background-color .4s, border-color .4s; }
|
||||
.mark.on { color: var(--art-ink); }
|
||||
.mark.on::before { background: #f5b83d; border-color: #f5b83d; }
|
||||
.mark.fresh::before { animation: fill 1.2s ease-out; }
|
||||
@keyframes fill { 0% { background: transparent; box-shadow: 0 0 0 0 rgba(245,184,61,.9); } 40% { background: #f5b83d; box-shadow: 0 0 0 5px rgba(245,184,61,0); } }
|
||||
.sheet { position: absolute; inset: auto 0 0 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 44px 12px 12px; font-size: 12px;
|
||||
background: linear-gradient(to bottom, rgba(13,16,33,0), rgba(13,16,33,.93) 34%); opacity: 0; visibility: hidden; transform: translateY(14px);
|
||||
transition: opacity .22s, transform .3s cubic-bezier(.2,.8,.2,1), visibility .22s; }
|
||||
.sheet strong { font: 600 15px/1.2 var(--display); letter-spacing: -.02em; margin-bottom: 6px; }
|
||||
.sheet span { display: flex; justify-content: space-between; gap: 6px; color: var(--art-soft); }
|
||||
.sheet b { color: var(--art-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
|
||||
/* Survol ou focus : la carte monte (sans grossir), l'illustration zoome à l'intérieur, la fiche glisse du bas. */
|
||||
.card:hover, .card:focus-visible { z-index: 2; transform: translateY(-10px); border-color: var(--gold); box-shadow: 0 18px 34px -14px rgba(0,0,0,.65), 0 0 28px -8px var(--gold-glow); outline: none; }
|
||||
.card:hover img, .card:focus-visible img { transform: scale(1.07); }
|
||||
.card:hover .sheet, .card:focus-visible .sheet { opacity: 1; visibility: visible; transform: none; }
|
||||
.card:hover .cap, .card:focus-visible .cap { opacity: 0; transform: translateY(6px); }
|
||||
.card.dim:hover, .card.dim:focus-visible { transform: translateY(-4px); box-shadow: 0 12px 24px -14px rgba(0,0,0,.6); border-color: var(--line); }
|
||||
/* Dans la main seulement, un voile sur les voisines (GPUI n'a pas de filtre de luminosité). */
|
||||
.card::after { content: ""; position: absolute; inset: 0; background: rgba(9, 11, 24, .42); opacity: 0; transition: opacity .3s; pointer-events: none; }
|
||||
.hand:has(.card:hover) .card:not(:hover)::after { opacity: 1; }
|
||||
|
||||
/* ---- Sélection : balayage, titre, main distribuée, « Autres champions ». ---- */
|
||||
.stage { display: grid; gap: 16px; }
|
||||
.stage-sub { margin: 0; color: var(--muted); font-size: 14px; }
|
||||
.stage-sub b { color: var(--gold-ink); }
|
||||
.sweep { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: linear-gradient(100deg, transparent 36%, var(--gold-soft) 48.5%, rgba(255,255,255,.16) 50%, var(--gold-soft) 51.5%, transparent 64%); background-size: 300% 100%; animation: sweep .9s ease-out both; }
|
||||
@keyframes sweep { 0% { background-position: 100% 0; opacity: 1; } 100% { background-position: 0 0; opacity: 0; } }
|
||||
.hand { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; max-width: 1000px; }
|
||||
@media (max-width: 720px) { .hand { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
|
||||
/* Distribuées depuis le bas, l'une après l'autre ; sans rotation dans l'appli. */
|
||||
.hand .card.deal { animation: deal .7s cubic-bezier(.2,1.25,.35,1) both; }
|
||||
@keyframes deal { 0% { transform: translateY(60vh); opacity: 0; } 100% { transform: none; opacity: 1; } }
|
||||
.hand .card.taken { transform: translateY(8px); }
|
||||
.hand .card.taken:hover { transform: translateY(5px); }
|
||||
.hand .card.leave { transition: transform .32s ease-in, opacity .32s; transform: translateY(48px); opacity: 0; }
|
||||
.others { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 8px; }
|
||||
.others summary { display: flex; align-items: center; gap: 10px; min-height: 50px; cursor: pointer; font-weight: 600; list-style: none; }
|
||||
.others summary::-webkit-details-marker { display: none; }
|
||||
.others summary::before { content: "›"; font-size: 18px; color: var(--muted); transition: transform .2s; }
|
||||
.others[open] summary::before { transform: rotate(90deg); }
|
||||
.others .count-n { color: var(--muted); font-weight: 500; }
|
||||
.others-body { display: grid; gap: 14px; padding-bottom: 18px; }
|
||||
|
||||
/* ---- Statistiques. ---- */
|
||||
.stats { display: grid; gap: 14px; }
|
||||
.stats-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
|
||||
.stats-head h1 { margin: 0; font: 600 clamp(24px, 3vw, 34px)/1.1 var(--display); letter-spacing: -.03em; }
|
||||
.stats-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
|
||||
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
|
||||
@media (max-width: 720px) { .stats-grid { grid-template-columns: minmax(0, 1fr); } }
|
||||
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
|
||||
.panel.wide { grid-column: 1 / -1; }
|
||||
.panel h2 { margin: 0; font: 600 15px/1.2 var(--display); letter-spacing: -.01em; }
|
||||
.panel p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
|
||||
.panel svg { display: block; width: 100%; height: auto; margin-top: 14px; overflow: visible; }
|
||||
.panel svg text { font: 500 10px var(--body); fill: var(--muted); font-variant-numeric: tabular-nums; }
|
||||
.panel svg .value { fill: var(--fg); font-weight: 650; }
|
||||
.grid-line { stroke: var(--line); stroke-width: 1; }
|
||||
.curve { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
|
||||
.curve-area { fill: var(--gold); opacity: .12; }
|
||||
.bar { fill: var(--faint); }
|
||||
.bar.lead { fill: var(--gold); }
|
||||
.hit { fill: transparent; }
|
||||
.hit:hover { fill: var(--gold-soft); opacity: .25; }
|
||||
|
||||
/* ---- Barre de démonstration, hors identité. ---- */
|
||||
.demo { position: fixed; z-index: 1000; left: 50%; bottom: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px);
|
||||
display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 5px; border-radius: 14px;
|
||||
border: 2px solid var(--bar-fg); background: var(--bar-bg); color: var(--bar-fg); box-shadow: 4px 4px 0 var(--bar-fg); font: 600 12px/1.2 Inter, system-ui, sans-serif; }
|
||||
.demo b { padding: 0 8px; }
|
||||
.demo button { color: var(--bar-fg); background: transparent; border: 1.5px solid transparent; border-radius: 9px; padding: 7px 10px; cursor: pointer; }
|
||||
.demo button:hover { border-color: var(--bar-fg); }
|
||||
.demo button[aria-pressed="true"] { background: var(--bar-fg); color: var(--bar-bg); }
|
||||
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="frame">
|
||||
<header class="top" id="top"></header>
|
||||
<main class="screen" id="screen"></main>
|
||||
</div>
|
||||
<nav class="demo" aria-label="Démonstration">
|
||||
<b>Démo</b>
|
||||
<button id="demo-match" type="button" title="Une Partie suivie en direct se termine, avec un champion et un Placement au hasard">Partie au hasard</button>
|
||||
<button id="demo-top1" type="button" title="Une Partie suivie en direct se termine sur un top 1">Top 1 au hasard</button>
|
||||
<button id="demo-select" type="button" aria-pressed="false">Sélection</button>
|
||||
<button id="demo-theme" type="button">Thème clair</button>
|
||||
<button id="demo-reset" type="button">Réinitialiser</button>
|
||||
</nav>
|
||||
<script>
|
||||
(() => {
|
||||
// [clé Data Dragon, nom, focus x %, focus y %]. Le focus situe l'art de chargement dans le splash ;
|
||||
// l'appli le calcule au téléchargement, ces valeurs viennent de ce calcul (et de son repli).
|
||||
const CHAMPS = [["Aatrox","Aatrox",65,30],["Ahri","Ahri",61,28],["Akali","Akali",50,30],["Akshan","Akshan",48,30],["Alistar","Alistar",61,30],["Ambessa","Ambessa",49,21],["Amumu","Amumu",68,30],["Anivia","Anivia",55,33],["Annie","Annie",78,33],["Aphelios","Aphelios",56,29],["Ashe","Ashe",68,30],["AurelionSol","Aurelion Sol",51,29],["Aurora","Aurora",56,24],["Azir","Azir",71,31],["Bard","Bard",62,30],["Belveth","Bel'Veth",49,26],["Blitzcrank","Blitzcrank",63,30],["Brand","Brand",76,31],["Braum","Braum",76,30],["Briar","Briar",55,33],["Caitlyn","Caitlyn",75,30],["Camille","Camille",72,20],["Cassiopeia","Cassiopeia",64,33],["Chogath","Cho'Gath",59,30],["Corki","Corki",69,34],["Darius","Darius",55,29],["Diana","Diana",67,39],["DrMundo","Dr. Mundo",52,29],["Draven","Draven",72,34],["Ekko","Ekko",72,24],["Elise","Elise",71,25],["Evelynn","Evelynn",52,28],["Ezreal","Ezreal",62,33],["Fiddlesticks","Fiddlesticks",57,40],["Fiora","Fiora",67,30],["Fizz","Fizz",82,28],["Galio","Galio",47,29],["Gangplank","Gangplank",71,33],["Garen","Garen",76,28],["Gnar","Gnar",72,37],["Gragas","Gragas",56,30],["Graves","Graves",71,30],["Gwen","Gwen",51,27],["Hecarim","Hecarim",66,25],["Heimerdinger","Heimerdinger",72,30],["Hwei","Hwei",57,30],["Illaoi","Illaoi",65,29],["Irelia","Irelia",50,30],["Ivern","Ivern",48,30],["Janna","Janna",79,33],["JarvanIV","Jarvan IV",73,30],["Jax","Jax",67,35],["Jayce","Jayce",72,37],["Jhin","Jhin",65,32],["Jinx","Jinx",69,28],["KSante","K'Santé",38,26],["Kaisa","Kai'Sa",49,26],["Kalista","Kalista",60,30],["Karma","Karma",72,25],["Karthus","Karthus",67,25],["Kassadin","Kassadin",63,24],["Katarina","Katarina",65,33],["Kayle","Kayle",76,35],["Kayn","Kayn",50,51],["Kennen","Kennen",75,33],["Khazix","Kha'Zix",80,35],["Kindred","Kindred",63,30],["Kled","Kled",75,30],["KogMaw","Kog'Maw",65,37],["Leblanc","LeBlanc",51,27],["LeeSin","Lee Sin",64,29],["Leona","Leona",75,25],["Lillia","Lillia",43,26],["Lissandra","Lissandra",68,24],["Locke","Locke",62,24],["Lucian","Lucian",71,47],["Lulu","Lulu",69,31],["Lux","Lux",62,28],["Malphite","Malphite",65,37],["Malzahar","Malzahar",63,30],["Maokai","Maokai",59,30],["MasterYi","Maître Yi",78,30],["Mel","Mel",44,30],["Milio","Milio",51,30],["MissFortune","Miss Fortune",69,39],["MonkeyKing","Wukong",62,30],["Mordekaiser","Mordekaiser",47,30],["Morgana","Morgana",73,32],["Naafiri","Naafiri",23,24],["Nami","Nami",75,33],["Nasus","Nasus",67,25],["Nautilus","Nautilus",75,27],["Neeko","Neeko",49,30],["Nidalee","Nidalee",74,24],["Nilah","Nilah",64,33],["Nocturne","Nocturne",65,30],["Nunu","Nunu et Willump",51,51],["Olaf","Olaf",62,33],["Orianna","Orianna",74,29],["Ornn","Ornn",50,33],["Pantheon","Pantheon",51,28],["Poppy","Poppy",67,30],["Pyke","Pyke",49,31],["Qiyana","Qiyana",52,30],["Quinn","Quinn",59,30],["Rakan","Rakan",57,30],["Rammus","Rammus",61,30],["RekSai","Rek'Sai",56,30],["Rell","Rell",47,21],["Renata","Renata Glasc",56,30],["Renekton","Renekton",58,30],["Rengar","Rengar",65,30],["Riven","Riven",75,30],["Rumble","Rumble",70,30],["Ryze","Ryze",62,35],["Samira","Samira",58,32],["Sejuani","Sejuani",54,29],["Senna","Senna",53,30],["Seraphine","Séraphine",50,26],["Sett","Sett",49,21],["Shaco","Shaco",71,28],["Shen","Shen",70,25],["Shyvana","Shyvana",51,30],["Singed","Singed",71,30],["Sion","Sion",68,30],["Sivir","Sivir",56,21],["Skarner","Skarner",52,35],["Smolder","Smolder",50,30],["Sona","Sona",80,30],["Soraka","Soraka",56,26],["Swain","Swain",67,30],["Sylas","Sylas",50,40],["Syndra","Syndra",51,24],["TahmKench","Tahm Kench",18,25],["Taliyah","Taliyah",72,30],["Talon","Talon",63,30],["Taric","Taric",71,25],["Teemo","Teemo",59,30],["Thresh","Thresh",64,30],["Tristana","Tristana",63,27],["Trundle","Trundle",59,30],["Tryndamere","Tryndamere",71,30],["TwistedFate","Twisted Fate",71,30],["Twitch","Twitch",57,32],["Udyr","Udyr",54,29],["Urgot","Urgot",58,23],["Varus","Varus",52,30],["Vayne","Vayne",77,24],["Veigar","Veigar",67,30],["Velkoz","Vel'Koz",56,32],["Vex","Vex",62,30],["Vi","Vi",71,30],["Viego","Viego",71,21],["Viktor","Viktor",49,30],["Vladimir","Vladimir",70,32],["Volibear","Volibear",56,26],["Warwick","Warwick",76,35],["Xayah","Xayah",89,33],["Xerath","Xerath",57,29],["XinZhao","Xin Zhao",52,29],["Yasuo","Yasuo",76,32],["Yone","Yone",58,21],["Yorick","Yorick",62,30],["Yunara","Yunara",65,28],["Yuumi","Yuumi",46,30],["Zaahen","Zaahen",56,23],["Zac","Zac",64,30],["Zed","Zed",66,26],["Zeri","Zeri",55,28],["Ziggs","Ziggs",73,30],["Zilean","Zilean",57,30],["Zoe","Zoé",52,27],["Zyra","Zyra",75,25]];
|
||||
const DDRAGON = "https://ddragon.leagueoflegends.com/cdn/img/champion";
|
||||
const SPLASH = { w: 1215, h: 717 };
|
||||
const SEASON = { name: "Saison 2 · 2026", start: Date.UTC(2026, 8, 10), days: 72 };
|
||||
const TODAY = SEASON.days - 1;
|
||||
const CROWN = "M68 186 L52 86 L98 126 L128 66 L158 126 L204 86 L188 186 Z";
|
||||
const CROWN_ICON = `<svg class="crown-ic" viewBox="40 56 176 140" aria-hidden="true"><path d="${CROWN}"/></svg>`;
|
||||
const LOGO = `<svg viewBox="0 0 256 256" aria-hidden="true"><circle cx="128" cy="128" r="124" fill="#f5b83d"/><circle cx="128" cy="128" r="100" fill="#161b2e"/><path fill="#f5b83d" d="${CROWN}"/></svg>`;
|
||||
const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
const $ = id => document.getElementById(id);
|
||||
const wait = ms => new Promise(done => setTimeout(done, ms));
|
||||
const esc = s => String(s).replace(/[&<>"]/g, ch => ({ "&": "&", "<": "<", ">": ">", '"': """ }[ch]));
|
||||
const norm = s => s.toLocaleLowerCase("fr").normalize("NFD").replace(/\p{M}|[^a-z0-9]/gu, "");
|
||||
const collator = new Intl.Collator("fr", { sensitivity: "base" });
|
||||
const dayFmt = new Intl.DateTimeFormat("fr-FR", { day: "numeric", month: "short", timeZone: "UTC" });
|
||||
const longFmt = new Intl.DateTimeFormat("fr-FR", { day: "2-digit", month: "2-digit", year: "numeric", timeZone: "UTC" });
|
||||
const day = d => dayFmt.format(new Date(SEASON.start + d * 86400000));
|
||||
const date = d => longFmt.format(new Date(SEASON.start + d * 86400000));
|
||||
const points = n => new Intl.NumberFormat("fr-FR").format(n);
|
||||
const place = p => p == null ? "—" : p === 1 ? "1ᵉʳ" : p + "ᵉ";
|
||||
const plural = (n, w) => `${n} ${w}${n > 1 ? "s" : ""}`;
|
||||
|
||||
// ---- Saison fictive. ----
|
||||
function rng(seed) {
|
||||
return () => {
|
||||
seed = (seed + 0x6D2B79F5) | 0;
|
||||
let t = Math.imul(seed ^ (seed >>> 15), 1 | seed);
|
||||
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
|
||||
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
||||
};
|
||||
}
|
||||
const placementOf = x => x < .17 ? 1 : x < .34 ? 2 : x < .52 ? 3 : x < .68 ? 4 : x < .84 ? 5 : 6;
|
||||
const isPlayed = c => c.matches.length > 0;
|
||||
const isCompleted = c => c.matches.some(m => m.p === 1);
|
||||
const hasWin = c => c.matches.some(m => m.p <= 3);
|
||||
const firstTop1 = c => c.matches.find(m => m.p === 1)?.day ?? null;
|
||||
const attempts = c => { const i = c.matches.findIndex(m => m.p === 1); return i < 0 ? c.matches.length : i + 1; };
|
||||
const best = c => c.matches.length ? Math.min(...c.matches.map(m => m.p)) : null;
|
||||
function generate() {
|
||||
const r = rng(20261121);
|
||||
const champions = CHAMPS.map(([key, name, fx, fy], i) => {
|
||||
const mastery = Math.round(Math.pow(r(), 2.6) * 420000);
|
||||
const played = r() < .3 + .55 * (mastery / 420000) + .12;
|
||||
const matches = [];
|
||||
if (played) {
|
||||
const count = 1 + Math.floor(Math.pow(r(), 1.25) * 6);
|
||||
const days = Array.from({ length: count }, () => Math.floor(r() * (SEASON.days - 2))).sort((a, b) => a - b);
|
||||
for (const d of days) matches.push({ p: placementOf(r()), day: d, seq: 0 });
|
||||
}
|
||||
return { id: i + 1, key, name, fx, fy, mastery, matches };
|
||||
}).sort((a, b) => collator.compare(a.name, b.name));
|
||||
const byM = list => list.sort((a, b) => b.mastery - a.mastery);
|
||||
const completed = byM(champions.filter(isCompleted));
|
||||
const remaining = byM(champions.filter(c => isPlayed(c) && !isCompleted(c)));
|
||||
const never = byM(champions.filter(c => !isPlayed(c)));
|
||||
const anvil = [completed[2], remaining[0], remaining[3], remaining[5], never[1]];
|
||||
anvil.forEach(c => c.anvil = true);
|
||||
anvil[2].ban = "Banni";
|
||||
anvil[3].ban = "Pris par un allié";
|
||||
anvil[3].later = true;
|
||||
return champions;
|
||||
}
|
||||
|
||||
const state = { champions: generate(), seq: 0, selection: false, allyTaken: false, screen: "defi", query: "", filter: "all", sort: "mastery", pending: null };
|
||||
const find = id => state.champions.find(c => c.id === id);
|
||||
const byMastery = list => [...list].sort((a, b) => b.mastery - a.mastery || collator.compare(a.name, b.name));
|
||||
const byName = list => [...list].sort((a, b) => collator.compare(a.name, b.name));
|
||||
const completedCount = () => state.champions.filter(isCompleted).length;
|
||||
const total = () => state.champions.length;
|
||||
const anvil = () => byMastery(state.champions.filter(c => c.anvil));
|
||||
const others = () => byMastery(state.champions.filter(c => !c.anvil));
|
||||
// Validations dans l'ordre, la plus ancienne d'abord ; deux du même jour gardent leur ordre d'arrivée.
|
||||
function validations() {
|
||||
const seqOf = c => c.matches.find(m => m.p === 1).seq;
|
||||
return state.champions.filter(isCompleted).map(c => ({ c, day: firstTop1(c) }))
|
||||
.sort((a, b) => a.day - b.day || seqOf(a.c) - seqOf(b.c) || a.c.id - b.c.id);
|
||||
}
|
||||
function reasons(c) {
|
||||
const out = [];
|
||||
if (isCompleted(c)) out.push("Validé");
|
||||
if (state.selection && c.ban && (!c.later || state.allyTaken)) out.push(c.ban);
|
||||
return out;
|
||||
}
|
||||
const pickable = c => !reasons(c).length;
|
||||
|
||||
// ---- La ligne « Dernière Partie », tirée des Parties enregistrées. ----
|
||||
function lastMatch() {
|
||||
let found = null;
|
||||
for (const c of state.champions) c.matches.forEach((m, i) => {
|
||||
if (!found || m.day > found.m.day || (m.day === found.m.day && m.seq > found.m.seq)) found = { c, m, i };
|
||||
});
|
||||
return found;
|
||||
}
|
||||
function lastMatchLine() {
|
||||
const last = lastMatch();
|
||||
if (!last) return "";
|
||||
const { c, m, i } = last;
|
||||
const first = c.matches.findIndex(x => x.p === 1);
|
||||
let detail = "";
|
||||
if (first === i) detail = i === 0 ? " · validé du premier coup" : ` · validé en ${i + 1} Tentatives`;
|
||||
else if (first < 0 || i < first) detail = ` · ${i === 0 ? "1ʳᵉ" : `${i + 1}ᵉ`} Tentative`;
|
||||
return `Dernière Partie : <b>${esc(c.name)}</b>, ${place(m.p)}${detail}`;
|
||||
}
|
||||
|
||||
// ---- L'anneau : une jauge à l'ordre fixe, qui ne suit pas le tri choisi. ----
|
||||
const SIZE = 520, C = SIZE / 2, R1 = 214, R2 = 246, PAD = 20, BOX = SIZE + 2 * PAD;
|
||||
function ringOrder() {
|
||||
const played = byMastery(state.champions.filter(c => isPlayed(c) && !isCompleted(c)));
|
||||
const never = byMastery(state.champions.filter(c => !isPlayed(c)));
|
||||
return [...validations().map(v => v.c), ...played, ...never];
|
||||
}
|
||||
const angleOf = (i, n) => -Math.PI / 2 + (i + .5) * 2 * Math.PI / n;
|
||||
const at = (a, r) => [C + r * Math.cos(a), C + r * Math.sin(a)];
|
||||
function ring() {
|
||||
const list = ringOrder(), n = list.length;
|
||||
const ticks = list.map((c, i) => {
|
||||
const a = angleOf(i, n), done = isCompleted(c) && state.pending !== c.id;
|
||||
const k = done ? "done" : isPlayed(c) ? "played" : "never";
|
||||
const [x1, y1] = at(a, done ? R1 : k === "played" ? R1 + 10 : R1 + 18);
|
||||
const [x2, y2] = at(a, done ? R2 : k === "played" ? R2 - 6 : R1 + 21);
|
||||
return `<line class="tick ${k} ${state.selection && c.anvil ? "anvil" : ""}" data-tick="${c.id}" x1="${x1.toFixed(1)}" y1="${y1.toFixed(1)}" x2="${x2.toFixed(1)}" y2="${y2.toFixed(1)}"/>`;
|
||||
}).join("");
|
||||
return `<div class="ring ${state.selection ? "dim" : ""}"><svg viewBox="${-PAD} ${-PAD} ${BOX} ${BOX}" role="img" aria-label="${completedCount()} champions validés sur ${n}">
|
||||
<circle class="disc" cx="${C}" cy="${C}" r="${R1 - 18}"/><g>${ticks}</g>
|
||||
<g transform="translate(${C - 82} ${C - 92}) scale(.64)"><path class="crown" d="${CROWN}"/></g>
|
||||
<path class="trail" opacity="0"/><circle class="comet" r="9" opacity="0" style="filter: drop-shadow(0 0 10px #f5b83d)"/></svg></div>`;
|
||||
}
|
||||
|
||||
// ---- Les cartes. ----
|
||||
function card(c, { lazy = true, deal = -1, appear = "" } = {}) {
|
||||
const rs = reasons(c);
|
||||
const badges = rs.map(r => `<span class="reason ${r === "Validé" ? "gold" : "ban"} ${appear === r ? "appear" : ""}">${r === "Validé" ? CROWN_ICON : ""}${esc(r)}</span>`).join("");
|
||||
const lines = [["Parties", c.matches.length], ["Victoires", c.matches.filter(m => m.p <= 3).length], ["Meilleur Placement", place(best(c))], ["Tentatives", attempts(c)], ["Points de maîtrise", points(c.mastery)]];
|
||||
if (isCompleted(c)) lines.push(["Premier top 1", date(firstTop1(c))]);
|
||||
const style = deal >= 0 ? ` style="animation-delay:${reduced ? 0 : 380 + deal * 110}ms"` : "";
|
||||
return `<button type="button" class="card ${rs.length ? "dim" : ""} ${deal >= 0 && !reduced ? "deal" : ""}" data-id="${c.id}" aria-label="${esc(c.name + (rs.length ? ", " + rs.join(", ") : ""))}"${style}>
|
||||
<img alt="" draggable="false" ${lazy ? 'loading="lazy"' : ""} src="${DDRAGON}/loading/${c.key}_0.jpg"><span class="shade"></span>
|
||||
<span class="reasons">${badges}</span>
|
||||
<span class="cap"><span class="name">${esc(c.name)}</span><span class="marks"><span class="mark ${isPlayed(c) ? "on" : ""}" data-mark="played">Joué</span><span class="mark ${hasWin(c) ? "on" : ""}" data-mark="win">Victoire</span></span></span>
|
||||
<span class="sheet" aria-hidden="true"><strong>${esc(c.name)}</strong>${lines.map(([k, v]) => `<span>${k}<b>${esc(v)}</b></span>`).join("")}</span>
|
||||
</button>`;
|
||||
}
|
||||
|
||||
// ---- La bannière, à l'accueil et en sélection. ----
|
||||
const ART = `<div class="art-box"><img class="art" alt=""><img class="art" alt=""></div><div class="grade"></div>`;
|
||||
const restChampion = () => state.selection
|
||||
? anvil().find(c => pickable(c) && !isCompleted(c)) || anvil()[0]
|
||||
: validations().map(v => v.c).filter(c => c.id !== state.pending).at(-1);
|
||||
function homeCopy() {
|
||||
const last = restChampion();
|
||||
const count = completedCount() - (state.pending ? 1 : 0);
|
||||
return `<div class="copy"><span class="kicker">${SEASON.name}</span>
|
||||
<h1 class="title"><span class="count">${count}</span> / ${total()} champions validés</h1>
|
||||
<div class="lines"><p class="line" data-line="validated">${last ? `Dernier champion validé : <b>${esc(last.name)}</b>, le ${day(firstTop1(last))}` : "Aucun champion validé pour l'instant."}</p>
|
||||
<p class="line" data-line="match">${lastMatchLine()}</p></div></div>`;
|
||||
}
|
||||
function stageCopy() {
|
||||
const open = anvil().filter(c => pickable(c) && !isCompleted(c)).length;
|
||||
return `<div class="copy"><span class="kicker">${SEASON.name} · ${completedCount()} / ${total()} validés</span>
|
||||
<h1 class="title stage-title ${reduced ? "" : "in"}">Sélection des champions</h1>
|
||||
<p class="stage-sub">Champions de l'Enclume · <b data-open>${open}</b> à valider et disponibles</p></div>`;
|
||||
}
|
||||
// Une fenêtre d'environ 80 % de la largeur du splash, centrée sur le champion et bornée à ses bords.
|
||||
function frameArt(img, c) {
|
||||
const box = img.parentElement.getBoundingClientRect();
|
||||
if (!box.width) return;
|
||||
const scale = Math.max(box.width / (SPLASH.w * .8), box.height / SPLASH.h);
|
||||
const w = SPLASH.w * scale, h = SPLASH.h * scale;
|
||||
const clamp = (v, lo) => Math.min(0, Math.max(lo, v));
|
||||
Object.assign(img.style, {
|
||||
width: `${w}px`, height: `${h}px`,
|
||||
left: `${clamp(box.width / 2 - c.fx / 100 * w, box.width - w)}px`,
|
||||
top: `${clamp(box.height / 2 - c.fy / 100 * h, box.height - h)}px`,
|
||||
});
|
||||
}
|
||||
let token = 0;
|
||||
function paint(c, { instant = false, settle = false } = {}) {
|
||||
const imgs = [...document.querySelectorAll(".banner .art")];
|
||||
if (!imgs.length || !c) return;
|
||||
const front = imgs.find(i => i.classList.contains("on"));
|
||||
if (front && front.dataset.id === String(c.id)) return;
|
||||
const back = imgs.find(i => i !== front);
|
||||
const mine = ++token;
|
||||
back.dataset.id = c.id;
|
||||
back.classList.remove("settle");
|
||||
frameArt(back, c);
|
||||
back.onload = () => {
|
||||
if (mine !== token) return;
|
||||
if (instant) back.style.transition = "none";
|
||||
if (settle && !reduced) back.classList.add("settle");
|
||||
back.classList.add("on");
|
||||
front?.classList.remove("on");
|
||||
if (instant) requestAnimationFrame(() => { back.style.transition = ""; });
|
||||
};
|
||||
back.src = `${DDRAGON}/splash/${c.key}_0.jpg`;
|
||||
}
|
||||
addEventListener("resize", () => document.querySelectorAll(".banner .art").forEach(img => img.dataset.id && frameArt(img, find(Number(img.dataset.id)))));
|
||||
|
||||
// ---- Écrans. ----
|
||||
const host = $("screen");
|
||||
function visible() {
|
||||
const q = norm(state.query);
|
||||
const keep = c => (state.filter === "all" || (state.filter === "done") === isCompleted(c)) && norm(c.name).includes(q);
|
||||
const list = state.champions.filter(keep);
|
||||
return state.sort === "name" ? byName(list) : byMastery(list);
|
||||
}
|
||||
function grid() {
|
||||
const list = visible();
|
||||
host.querySelector(".n").textContent = list.length;
|
||||
host.querySelector("#grid").innerHTML = list.map(c => card(c)).join("") || `<p class="empty">Aucun champion trouvé.</p>`;
|
||||
}
|
||||
function home() {
|
||||
host.innerHTML = `<section class="banner">${ART}${ring()}${homeCopy()}</section>
|
||||
<div class="tools"><h2>Champions <span class="n"></span></h2>
|
||||
<div class="tabs" role="group" aria-label="Filtrer les champions">${[["all", "Tous"], ["todo", "Restants"], ["done", "Validés"]].map(([k, l]) => `<button type="button" data-filter="${k}" aria-pressed="${state.filter === k}">${l}</button>`).join("")}</div>
|
||||
<label class="sort">Trier <select id="sort"><option value="mastery" ${state.sort === "mastery" ? "selected" : ""}>Points de maîtrise</option><option value="name" ${state.sort === "name" ? "selected" : ""}>A–Z</option></select></label>
|
||||
<input class="search" id="search" type="search" placeholder="Rechercher…" aria-label="Rechercher un champion" value="${esc(state.query)}"></div>
|
||||
<div class="cards" id="grid"></div>`;
|
||||
host.querySelectorAll("[data-filter]").forEach(b => b.onclick = () => {
|
||||
state.filter = b.dataset.filter;
|
||||
host.querySelectorAll("[data-filter]").forEach(x => x.setAttribute("aria-pressed", String(x === b)));
|
||||
grid();
|
||||
});
|
||||
host.querySelector("#sort").onchange = e => { state.sort = e.target.value; grid(); };
|
||||
host.querySelector("#search").oninput = e => { state.query = e.target.value; grid(); };
|
||||
grid();
|
||||
}
|
||||
function stage() {
|
||||
host.innerHTML = `<section class="stage" aria-label="Sélection des champions">
|
||||
${reduced ? "" : `<div class="sweep" aria-hidden="true"></div>`}
|
||||
<div class="banner">${ART}${ring()}${stageCopy()}</div>
|
||||
<div class="hand">${anvil().map((c, i) => card(c, { lazy: false, deal: i })).join("")}</div>
|
||||
<details class="others"><summary>Autres champions <span class="count-n">${others().length}</span></summary><div class="others-body"></div></details></section>`;
|
||||
host.querySelector(".sweep")?.addEventListener("animationend", e => e.target.remove());
|
||||
// Une fois distribuée, la carte perd son animation d'entrée, sinon son état final bloquerait la montée au survol.
|
||||
host.querySelector(".hand").addEventListener("animationend", e => {
|
||||
if (e.animationName === "deal") { e.target.classList.remove("deal"); e.target.style.animationDelay = ""; }
|
||||
});
|
||||
const fold = host.querySelector(".others");
|
||||
fold.addEventListener("toggle", () => {
|
||||
const body = fold.querySelector(".others-body");
|
||||
if (!fold.open) { body.replaceChildren(); return; }
|
||||
body.innerHTML = `<input class="search" type="search" placeholder="Rechercher…" aria-label="Rechercher parmi les autres champions"><div class="cards"></div>`;
|
||||
const fill = q => { body.querySelector(".cards").innerHTML = others().filter(c => norm(c.name).includes(norm(q))).map(c => card(c)).join("") || `<p class="empty">Aucun champion trouvé.</p>`; };
|
||||
body.querySelector("input").oninput = e => fill(e.target.value);
|
||||
fill("");
|
||||
});
|
||||
}
|
||||
function stats() {
|
||||
const v = validations();
|
||||
const perDay = Array.from({ length: SEASON.days }, (_, d) => v.filter(x => x.day <= d).length);
|
||||
const W = 640, H = 170, L = 34, B = 24, T = 10, R = 12;
|
||||
const max = Math.max(10, Math.ceil(completedCount() / 10) * 10);
|
||||
const x = d => L + d / (SEASON.days - 1) * (W - L - R), y = n => T + (1 - n / max) * (H - T - B);
|
||||
const line = perDay.map((n, d) => `${d ? "L" : "M"}${x(d).toFixed(1)} ${y(n).toFixed(1)}`).join(" ");
|
||||
const end = perDay.at(-1);
|
||||
const curve = `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Champions validés au fil de la Saison : ${end} aujourd'hui">
|
||||
${[0, max / 2, max].map(n => `<line class="grid-line" x1="${L}" x2="${W - R}" y1="${y(n)}" y2="${y(n)}"/><text x="${L - 8}" y="${y(n) + 4}" text-anchor="end">${n}</text>`).join("")}
|
||||
${[0, Math.round((SEASON.days - 1) / 2), SEASON.days - 1].map((d, i) => `<text x="${x(d)}" y="${H - 6}" text-anchor="${["start", "middle", "end"][i]}">${day(d)}</text>`).join("")}
|
||||
<path class="curve-area" d="${line} L${x(SEASON.days - 1)} ${y(0)} L${x(0)} ${y(0)} Z"/><path class="curve" d="${line}"/>
|
||||
<circle cx="${x(SEASON.days - 1)}" cy="${y(end)}" r="4.5" fill="var(--gold)" stroke="var(--surface)" stroke-width="2"/>
|
||||
<text class="value" x="${x(SEASON.days - 1) - 10}" y="${y(end) - 10}" text-anchor="end">${end}</text>
|
||||
${perDay.map((n, d) => `<rect class="hit" x="${(x(d) - 4).toFixed(1)}" y="${T}" width="8" height="${H - T - B}"><title>${day(d)} · ${n} validés</title></rect>`).join("")}</svg>`;
|
||||
const bars = (counts, labels, caption) => {
|
||||
const BW = 300, BH = 140, top = Math.max(...counts, 1), slot = BW / counts.length;
|
||||
return `<svg viewBox="0 0 ${BW} ${BH + 20}" role="img" aria-label="${caption}"><line class="grid-line" x1="0" x2="${BW}" y1="${BH}" y2="${BH}"/>${counts.map((n, i) => {
|
||||
const h = Math.max(n ? 3 : 0, n / top * (BH - 22)), bx = i * slot + slot * .2, bw = slot * .6;
|
||||
return `<path class="bar ${i === 0 ? "lead" : ""}" d="M${bx} ${BH} V${BH - h + 4} q0 -4 4 -4 h${bw - 8} q4 0 4 4 V${BH} Z"><title>${labels[i]} · ${n}</title></path>
|
||||
<text x="${bx + bw / 2}" y="${BH + 15}" text-anchor="middle">${labels[i]}</text>${i === 0 ? `<text class="value" x="${bx + bw / 2}" y="${BH - h - 6}" text-anchor="middle">${n}</text>` : ""}`;
|
||||
}).join("")}</svg>`;
|
||||
};
|
||||
const placements = [1, 2, 3, 4, 5, 6].map(p => state.champions.reduce((s, c) => s + c.matches.filter(m => m.p === p).length, 0));
|
||||
const tries = [1, 2, 3, 4, 5].map(k => v.filter(e => k < 5 ? attempts(e.c) === k : attempts(e.c) >= 5).length);
|
||||
host.innerHTML = `<section class="stats"><div class="stats-head"><div><h1>Statistiques</h1><p>${SEASON.name} · tous les Formats</p></div><p>${completedCount()} / ${total()} champions validés</p></div>
|
||||
<div class="stats-grid"><article class="panel wide"><h2>Courbe des validations</h2><p>Champions validés, cumulés jour après jour.</p>${curve}</article>
|
||||
<article class="panel"><h2>Placements</h2><p>Toutes les Parties de la Saison.</p>${bars(placements, ["1ᵉʳ", "2ᵉ", "3ᵉ", "4ᵉ", "5ᵉ", "6ᵉ"], "Parties par Placement")}</article>
|
||||
<article class="panel"><h2>Tentatives</h2><p>Parties jouées jusqu'au premier top 1.</p>${bars(tries, ["1", "2", "3", "4", "5+"], "Champions validés par nombre de Tentatives")}</article></div></section>`;
|
||||
}
|
||||
function fill() {
|
||||
cancelAnimationFrame(raf);
|
||||
state.pending = null;
|
||||
if (state.screen === "stats") return stats();
|
||||
state.selection ? stage() : home();
|
||||
paint(restChampion(), { instant: true });
|
||||
}
|
||||
function renderTop() {
|
||||
const sel = state.selection;
|
||||
$("top").innerHTML = `<span class="brand">${LOGO}Arena Tracker</span>
|
||||
<nav class="nav" aria-label="Navigation"><button type="button" data-screen="defi" ${state.screen === "defi" ? 'aria-current="page"' : ""}>Défi</button>
|
||||
<button type="button" data-screen="stats" ${state.screen === "stats" ? 'aria-current="page"' : ""} ${sel ? "disabled" : ""}>Statistiques</button></nav>`;
|
||||
$("top").querySelectorAll("[data-screen]").forEach(b => b.onclick = () => go(b.dataset.screen));
|
||||
}
|
||||
|
||||
// Changement d'écran : court, dans le sens du trajet ; la barre du haut ne bouge pas.
|
||||
let swapSeq = 0;
|
||||
async function swap(fn, kind) {
|
||||
const seq = ++swapSeq;
|
||||
host.getAnimations?.().forEach(a => a.cancel());
|
||||
if (reduced || !host.animate) return fn();
|
||||
if (kind === "stage-out") {
|
||||
host.querySelectorAll(".hand .card").forEach((c, i, all) => { c.classList.remove("deal"); c.style.transitionDelay = `${(all.length - 1 - i) * 35}ms`; c.classList.add("leave"); });
|
||||
await wait(240);
|
||||
if (seq !== swapSeq) return;
|
||||
}
|
||||
const out = { forward: "translateX(-14px)", back: "translateX(14px)", "stage-in": "translateY(-6px)", "stage-out": "translateY(16px)" }[kind];
|
||||
await host.animate([{ opacity: 1, transform: "none" }, { opacity: 0, transform: out }], { duration: 130, easing: "ease-in", fill: "forwards" }).finished.catch(() => {});
|
||||
if (seq !== swapSeq) return;
|
||||
fn();
|
||||
host.getAnimations().forEach(a => a.cancel());
|
||||
const from = { forward: "translateX(18px)", back: "translateX(-18px)", "stage-out": "translateY(10px)" }[kind];
|
||||
if (from) host.animate([{ opacity: 0, transform: from }, { opacity: 1, transform: "none" }], { duration: 280, easing: "cubic-bezier(.2,.8,.2,1)" });
|
||||
}
|
||||
function go(name) {
|
||||
if (name === state.screen || (name === "stats" && state.selection)) return;
|
||||
state.screen = name;
|
||||
renderTop();
|
||||
swap(fill, name === "stats" ? "forward" : "back");
|
||||
}
|
||||
|
||||
// ---- Survol : la graduation du champion s'allume ; en sélection la bannière le montre. ----
|
||||
let hovered = null;
|
||||
function hover(id) {
|
||||
if (id === hovered) return;
|
||||
hovered = id;
|
||||
host.querySelectorAll(".tick.lit").forEach(t => t.classList.remove("lit"));
|
||||
if (id) host.querySelector(`.tick[data-tick="${id}"]`)?.classList.add("lit");
|
||||
if (state.selection && state.screen === "defi") paint(id ? find(id) : restChampion());
|
||||
}
|
||||
const idOf = t => { const el = t?.closest?.("[data-id]"); return el && host.contains(el) ? Number(el.dataset.id) : null; };
|
||||
host.addEventListener("pointerover", e => hover(idOf(e.target)));
|
||||
host.addEventListener("pointerleave", () => hover(null));
|
||||
host.addEventListener("focusin", e => hover(idOf(e.target)));
|
||||
host.addEventListener("focusout", e => hover(host.contains(e.relatedTarget) ? idOf(e.relatedTarget) : null));
|
||||
|
||||
// ---- Fin d'une Partie suivie en direct : une animation à la mesure de ce qu'elle apporte. ----
|
||||
let raf = 0;
|
||||
function redrawRing() {
|
||||
const old = host.querySelector(".ring");
|
||||
old.insertAdjacentHTML("afterend", ring());
|
||||
old.remove();
|
||||
return host.querySelector(".ring svg");
|
||||
}
|
||||
function refreshCard(c, appear) {
|
||||
const el = host.querySelector(`#grid .card[data-id="${c.id}"]`);
|
||||
if (el) el.outerHTML = card(c, { appear });
|
||||
return host.querySelector(`#grid .card[data-id="${c.id}"]`);
|
||||
}
|
||||
function matchEnded(c, kind, gained) {
|
||||
if (state.screen !== "defi" || state.selection) { if (state.screen === "stats") stats(); return; }
|
||||
hover(null);
|
||||
if (kind === "top1") return comet(c);
|
||||
const svg = redrawRing();
|
||||
const tick = svg.querySelector(`.tick[data-tick="${c.id}"]`);
|
||||
tick.classList.add(kind === "mark" ? "step" : "blink");
|
||||
const lineEl = host.querySelector('[data-line="match"]');
|
||||
lineEl.innerHTML = lastMatchLine();
|
||||
lineEl.classList.remove("fresh"); void lineEl.offsetWidth; lineEl.classList.add("fresh");
|
||||
const el = refreshCard(c);
|
||||
for (const m of gained) el?.querySelector(`[data-mark="${m}"]`)?.classList.add("fresh");
|
||||
}
|
||||
// Top 1 : la comète part de midi jusqu'à la graduation, puis la bannière change de champion.
|
||||
function comet(c) {
|
||||
cancelAnimationFrame(raf);
|
||||
state.pending = c.id;
|
||||
const svg = redrawRing();
|
||||
const list = ringOrder(), n = list.length, index = list.findIndex(x => x.id === c.id);
|
||||
const finish = () => {
|
||||
if (state.pending !== c.id) return;
|
||||
state.pending = null;
|
||||
const a = angleOf(index, n), [x1, y1] = at(a, R1), [x2, y2] = at(a, R2);
|
||||
const tick = svg.querySelector(`.tick[data-tick="${c.id}"]`);
|
||||
tick.setAttribute("class", "tick done ignite");
|
||||
tick.setAttribute("x1", x1); tick.setAttribute("y1", y1); tick.setAttribute("x2", x2); tick.setAttribute("y2", y2);
|
||||
if (!reduced) svg.querySelector(".crown").classList.add("bounce");
|
||||
host.querySelector(".copy").outerHTML = homeCopy();
|
||||
if (!reduced) host.querySelector(".count").classList.add("roll");
|
||||
host.querySelectorAll(".line").forEach(l => l.classList.add("fresh"));
|
||||
paint(c, { settle: true });
|
||||
refreshCard(c, "Validé");
|
||||
};
|
||||
if (reduced) return finish();
|
||||
const dot = svg.querySelector(".comet"), trail = svg.querySelector(".trail");
|
||||
const start = angleOf(0, n) - Math.PI / n, end = angleOf(index, n), r = (R1 + R2) / 2;
|
||||
const t0 = performance.now(), duration = 650 + 550 * (index / n);
|
||||
const ease = t => 1 - Math.pow(1 - t, 3);
|
||||
function fly(now) {
|
||||
const t = Math.min(1, (now - t0) / duration), a = start + (end - start) * ease(t);
|
||||
const [x, y] = at(a, r);
|
||||
dot.setAttribute("cx", x); dot.setAttribute("cy", y); dot.setAttribute("opacity", "1");
|
||||
const [sx, sy] = at(Math.max(start, a - .9), r);
|
||||
trail.setAttribute("d", `M ${sx} ${sy} A ${r} ${r} 0 0 1 ${x} ${y}`);
|
||||
trail.setAttribute("opacity", String(.85 * (1 - t * .6)));
|
||||
if (t < 1) raf = requestAnimationFrame(fly);
|
||||
else { dot.setAttribute("opacity", "0"); trail.setAttribute("opacity", "0"); raf = 0; finish(); }
|
||||
}
|
||||
raf = requestAnimationFrame(fly);
|
||||
}
|
||||
function playMatch(forceTop1) {
|
||||
const pool = state.champions.filter(c => forceTop1 ? isPlayed(c) && !isCompleted(c) : true);
|
||||
const c = pool[Math.floor(Math.random() * pool.length)];
|
||||
if (!c) return;
|
||||
const p = forceTop1 ? 1 : placementOf(Math.random());
|
||||
const was = { played: isPlayed(c), win: hasWin(c), completed: isCompleted(c) };
|
||||
c.matches.push({ p, day: TODAY, seq: ++state.seq });
|
||||
const gained = [!was.played && "played", !was.win && p <= 3 && "win"].filter(Boolean);
|
||||
const kind = !was.completed && p === 1 ? "top1" : gained.length ? "mark" : "match";
|
||||
matchEnded(c, kind, gained);
|
||||
}
|
||||
|
||||
// ---- Démo. ----
|
||||
let allyTimer = 0;
|
||||
function toggleSelection() {
|
||||
clearTimeout(allyTimer);
|
||||
const from = state.screen;
|
||||
state.selection = !state.selection;
|
||||
state.allyTaken = false;
|
||||
state.screen = "defi";
|
||||
$("demo-select").setAttribute("aria-pressed", String(state.selection));
|
||||
renderTop();
|
||||
// Une sélection ouvre toujours « Défi », même depuis « Statistiques ».
|
||||
swap(fill, state.selection ? "stage-in" : from === "stats" ? "back" : "stage-out");
|
||||
if (state.selection) allyTimer = setTimeout(() => {
|
||||
state.allyTaken = true;
|
||||
const c = anvil().find(x => x.later);
|
||||
const el = host.querySelector(`.hand .card[data-id="${c.id}"]`);
|
||||
if (!el) return;
|
||||
el.querySelector(".reasons").insertAdjacentHTML("beforeend", `<span class="reason ban appear">${esc(c.ban)}</span>`);
|
||||
el.classList.add("dim", "taken");
|
||||
const open = host.querySelector("[data-open]");
|
||||
if (open) open.textContent = anvil().filter(x => pickable(x) && !isCompleted(x)).length;
|
||||
if (!hovered) paint(restChampion());
|
||||
}, 2600);
|
||||
}
|
||||
const root = document.documentElement;
|
||||
const themeLabel = () => { $("demo-theme").textContent = root.dataset.mode === "light" ? "Thème sombre" : "Thème clair"; };
|
||||
$("demo-theme").onclick = () => { root.dataset.mode = root.dataset.mode === "light" ? "dark" : "light"; themeLabel(); };
|
||||
if (matchMedia("(prefers-color-scheme: light)").matches) root.dataset.mode = "light";
|
||||
themeLabel();
|
||||
$("demo-match").onclick = () => playMatch(false);
|
||||
$("demo-top1").onclick = () => playMatch(true);
|
||||
$("demo-select").onclick = toggleSelection;
|
||||
$("demo-reset").onclick = () => {
|
||||
clearTimeout(allyTimer);
|
||||
Object.assign(state, { champions: generate(), seq: 0, selection: false, allyTaken: false, screen: "defi", query: "", filter: "all", pending: null });
|
||||
$("demo-select").setAttribute("aria-pressed", "false");
|
||||
renderTop();
|
||||
fill();
|
||||
};
|
||||
window.AT = { state, playMatch, toggleSelection, go, lastMatchLine };
|
||||
renderTop();
|
||||
fill();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user