Prototype lightning, twinkle and firefly particles in the visual lab

The Particles tab of the visual lab now previews three persistent particle
animations for mythic cards, drawn on a canvas inside the illustration or over
the whole card. Lightning bolts grow from the edges towards a random point near
the hero and pass behind a cut-out hero with the prismatic parallax. Twinkles
pop chosen motifs in and out with a light cross at their peak. Fireflies drift
on winding paths, pulse and move away from the pointer. Each animation offers a
palette, a zone and its own sliders, runs only on a large or hovered card, and
stays still under reduced motion. Nothing is saved on the variations yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-22 16:07:22 +01:00
parent 9f70bea523
commit f77a0ca577
15 changed files with 1779 additions and 16 deletions

View file

@ -1006,11 +1006,59 @@ test("administrator navigates sections, manages mythic content and previews visu
await chooseOption(bench, "Format", "Standard");
await expect(labCard.locator('.nebula-card-art img[src$="/astral-genesis/legendary/mythic_card_pull.webp"]')).toHaveCount(1);
await expect(bench.getByRole("heading", { name: "Prisme spectral", exact: true })).toBeVisible();
// L'onglet Particules ne propose encore aucune animation.
// L'onglet Particules essaie les éclairs : un canvas dans l'illustration, avec palette, intensité et fréquence.
await bench.getByRole("tab", { name: "Particules" }).click();
await expect(bench.getByRole("tab", { name: "Particules" })).toHaveAttribute("aria-selected", "true");
await expect(selectTrigger(bench, "Animation")).toBeDisabled();
await expect(selectTrigger(bench, "Animation")).toHaveText("Aucune");
await expect(labCard.locator(".nebula-card-flare")).toHaveCount(0);
await chooseOption(bench, "Animation", "Éclairs");
await expect(labCard).toHaveAttribute("data-flare", "lightning");
const lightningCanvas = labCard.locator(".nebula-card-art > .nebula-card-flare");
await expect(lightningCanvas).toHaveCount(1);
expect(await lightningCanvas.evaluate((canvas) => canvas.width > 0 && canvas.height > 0)).toBe(true);
// L'animation dessine : des pixels apparaissent dans le canvas d'une carte affichée en grand.
await expect.poll(() => lightningCanvas.evaluate((canvas) => canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height).data.some((value, index) => index % 4 === 3 && value > 0)), { timeout: 5000 }).toBe(true);
await expect(bench.getByRole("button", { name: "Palette des particules : Comme le holo" })).toBeVisible();
await expect(bench.getByRole("slider", { name: "Fréquence" })).toHaveValue("3");
await expect(bench.locator(".nebula-admin-customizer-summary")).toContainText("Particules : éclairs");
// Sur toute la carte, le canvas couvre la face, sous la description et le nom ; retour à l'illustration ensuite.
await chooseOption(bench, "Zone", "Toute la carte");
await expect(labCard.locator(".nebula-card-face > .nebula-card-flare")).toHaveAttribute("data-flare-scope", "card");
await expect(labCard.locator(".nebula-card-art .nebula-card-flare")).toHaveCount(0);
await chooseOption(bench, "Zone", "Illustration");
await expect(labCard.locator(".nebula-card-art > .nebula-card-flare")).toHaveCount(1);
// Avec la parallaxe, les éclairs passent entre le décor et le héros détouré.
await tryEffect("Parallaxe prismatique");
await expect(labCard.locator('.nebula-card-flare-plane + [data-depth-layer="subject"]')).toHaveCount(1);
await expect(labCard.locator(".nebula-card-flare")).toHaveAttribute("data-behind-subject", "true");
await tryEffect("Prisme spectral");
// Les scintillements : motifs qui apparaissent et disparaissent, devant l'illustration ; motif, nombre, vitesse, intensité.
await chooseOption(bench, "Animation", "Scintillements");
await expect(labCard.locator(".nebula-card-art > .nebula-card-flare")).toHaveAttribute("data-flare", "twinkle");
await expect(selectTrigger(bench, "Motif")).toHaveText("Étoile à quatre branches");
await expect(bench.getByRole("slider")).toHaveCount(3);
await expect(bench.getByRole("slider", { name: "Nombre" })).toHaveAttribute("aria-valuetext", "≈ 4");
await expect(bench.getByRole("slider", { name: "Vitesse" })).toBeVisible();
await chooseOption(bench, "Motif", "Cœur");
const twinkleCanvas = labCard.locator(".nebula-card-art > .nebula-card-flare");
await expect.poll(() => twinkleCanvas.evaluate((canvas) => canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height).data.some((value, index) => index % 4 === 3 && value > 0)), { timeout: 5000 }).toBe(true);
// Les lucioles : lueurs qui flottent et pulsent, avec leurs propres motifs et paliers.
await chooseOption(bench, "Animation", "Lucioles");
await expect(labCard.locator(".nebula-card-art > .nebula-card-flare")).toHaveAttribute("data-flare", "fireflies");
// Le motif choisi pour les scintillements (Cœur) existe aussi chez les lucioles : il est gardé.
await expect(selectTrigger(bench, "Motif")).toHaveText("Cœur");
await expect(bench.getByRole("slider", { name: "Nombre" })).toHaveAttribute("aria-valuetext", "≈ 8");
await expect.poll(() => labCard.locator(".nebula-card-art > .nebula-card-flare").evaluate((canvas) => canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height).data.some((value, index) => index % 4 === 3 && value > 0)), { timeout: 5000 }).toBe(true);
await expect(bench.locator(".nebula-admin-customizer-summary")).toContainText("Particules : lucioles");
await chooseOption(bench, "Animation", "Scintillements");
// Même avec la parallaxe, les scintillements restent devant le héros.
await tryEffect("Parallaxe prismatique");
await expect(labCard.locator(".nebula-card-flare-plane")).toHaveCount(0);
await expect(labCard.locator(".nebula-card-art > .nebula-card-flare")).toHaveCount(1);
await tryEffect("Prisme spectral");
await chooseOption(bench, "Animation", "Aucune");
await expect(labCard).not.toHaveAttribute("data-flare");
await expect(labCard.locator(".nebula-card-flare")).toHaveCount(0);
await bench.getByRole("tab", { name: "Holo" }).click();
const paletteTrigger = bench.getByRole("button", { name: "Palette holographique : Arc-en-ciel" });
const paletteTriggerLabel = paletteTrigger.getByText("Arc-en-ciel", { exact: true });