Add the Prismatic Backdrop holographic effect for cutout artwork

The new mythic effect works on two levels. An opaque iridescent film is
painted under the artwork and only shows through its transparent areas,
while a light overlay makes the whole card shine. Both follow the card
tilt without any running animation, like the Diffraction Sheen.

Cards can declare cutout versions of their artwork with the __cutout
suffix: cutoutImage for the standard format and fullCutoutImage for the
full-art format. The catalog only accepts the format's own image name
followed by __cutout. Prismatic Backdrop finishes use them when present
and fall back to the opaque artwork otherwise. The Mythic Card Pull gets
both cutout versions, and the admin visual lab previews the effect on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-08 21:33:35 +01:00
parent 24992e5502
commit bd1da42c7f
9 changed files with 76 additions and 7 deletions

View file

@ -798,7 +798,16 @@ test("administrator navigates sections, manages mythic content and previews visu
expect(Math.abs((mythicBox.x - gridBox.x) - (gridBox.x + gridBox.width - mythicBox.x - mythicBox.width))).toBeLessThanOrEqual(1); expect(Math.abs((mythicBox.x - gridBox.x) - (gridBox.x + gridBox.width - mythicBox.x - mythicBox.width))).toBeLessThanOrEqual(1);
const effectStyles = page.locator(".nebula-admin-effect-grid .nebula-admin-style-card"); const effectStyles = page.locator(".nebula-admin-effect-grid .nebula-admin-style-card");
await expect(effectStyles.locator("h4")).toHaveText(["Prisme spectral", "Reflet diffractif"]); await expect(effectStyles.locator("h4")).toHaveText(["Prisme spectral", "Reflet diffractif", "Écrin prismatique"]);
// L'Écrin prismatique affiche la version à zones vides de chaque format : sa sous-couche se voit à travers.
const backdropStyle = effectStyles.filter({ has: page.getByRole("heading", { name: "Écrin prismatique", exact: true }) });
const backdropCard = backdropStyle.locator('.nebula-card[data-holo-effect="prismatic-backdrop"]');
await expect(backdropCard.locator('.nebula-card-art img[src$="/mythic_card_pull__cutout.webp"]')).toBeVisible();
await expect(backdropCard.locator(".nebula-card-art .nebula-card-holo-underlay")).toHaveCSS("display", "block");
await chooseOption(backdropStyle, "Format", "Pleine illustration");
await expect(backdropCard.locator('.nebula-card-art img[src$="/mythic_card_pull__full__cutout.webp"]')).toBeVisible();
await chooseOption(backdropStyle, "Format", "Standard");
await expect(effectStyles.filter({ has: page.getByRole("heading", { name: "Prisme spectral", exact: true }) }).locator(".nebula-card-holo-underlay")).toHaveCount(0);
const spectralStyle = effectStyles.filter({ has: page.getByRole("heading", { name: "Prisme spectral", exact: true }) }); const spectralStyle = effectStyles.filter({ has: page.getByRole("heading", { name: "Prisme spectral", exact: true }) });
// Les aperçus holographiques gardent le vrai format `lg`, 300 x 420 px. // Les aperçus holographiques gardent le vrai format `lg`, 300 x 420 px.
const holoPreviewBox = await spectralStyle.locator(".nebula-admin-style-preview > .nebula-card").boundingBox(); const holoPreviewBox = await spectralStyle.locator(".nebula-admin-style-preview > .nebula-card").boundingBox();

View file

@ -124,6 +124,12 @@ export function validateCardsCatalog(catalog) {
if (!card.description || card.description.length > 200) throw new TypeError(`Card ${card.id} description must contain 1 to 200 characters.`); if (!card.description || card.description.length > 200) throw new TypeError(`Card ${card.id} description must contain 1 to 200 characters.`);
if (card.image != null && !CARD_IMAGE_PATTERN.test(card.image)) throw new TypeError(`Card ${card.id} image must use a canonical WebP path.`); if (card.image != null && !CARD_IMAGE_PATTERN.test(card.image)) throw new TypeError(`Card ${card.id} image must use a canonical WebP path.`);
if (card.fullImage != null && !CARD_IMAGE_PATTERN.test(card.fullImage)) throw new TypeError(`Card ${card.id} full image must use a canonical WebP path.`); if (card.fullImage != null && !CARD_IMAGE_PATTERN.test(card.fullImage)) throw new TypeError(`Card ${card.id} full image must use a canonical WebP path.`);
// Illustrations à zones vides : même fichier que l'illustration de leur format, suffixé `__cutout`, pour les effets à sous-couche.
for (const [cutoutKey, imageKey, label] of [["cutoutImage", "image", "image"], ["fullCutoutImage", "fullImage", "full image"]]) {
if (card[cutoutKey] != null && (!card[imageKey] || card[cutoutKey] !== card[imageKey].replace(/\.webp$/, "__cutout.webp"))) {
throw new TypeError(`Card ${card.id} ${cutoutKey === "cutoutImage" ? "cutout" : "full cutout"} image must be its ${label} suffixed with __cutout.`);
}
}
} }
for (const edition of catalog.editions) { for (const edition of catalog.editions) {

View file

@ -128,7 +128,17 @@ test("full-art mythics need a full image and declare one per legendary card", as
assert.ok(card.fullImage, `${cardId} needs a full image`); assert.ok(card.fullImage, `${cardId} needs a full image`);
await access(`website/public${card.image}`); await access(`website/public${card.image}`);
await access(`website/public${card.fullImage}`); await access(`website/public${card.fullImage}`);
if (card.cutoutImage) await access(`website/public${card.cutoutImage}`);
if (card.fullCutoutImage) await access(`website/public${card.fullCutoutImage}`);
} }
// Une illustration à zones vides reprend le nom de l'illustration pleine, suffixé `__cutout`.
assert.ok(baseCatalog.cards.some((card) => card.fullCutoutImage?.endsWith("__full__cutout.webp")));
const wrongCutout = structuredClone(rawCatalog);
wrongCutout.cards.find((card) => card.id === "mythic-card-pull").fullCutoutImage = "/static/img/cards/astral-genesis/legendary/mythic_card_pull__cutout.webp";
assert.throws(() => prepareVersionedCatalog(wrongCutout), /suffixed with __cutout/);
const wrongStandardCutout = structuredClone(rawCatalog);
wrongStandardCutout.cards.find((card) => card.id === "mythic-card-pull").cutoutImage = "/static/img/cards/astral-genesis/legendary/mythic_card_pull__full__cutout.webp";
assert.throws(() => prepareVersionedCatalog(wrongStandardCutout), /cutout image must be its image suffixed/);
const directory = await mkdtemp(join(tmpdir(), "sokkog-cards-full-art-")); const directory = await mkdtemp(join(tmpdir(), "sokkog-cards-full-art-"));
const database = new CardsDatabase(join(directory, "cards.sqlite")); const database = new CardsDatabase(join(directory, "cards.sqlite"));
t.after(async () => { t.after(async () => {
@ -232,7 +242,7 @@ test("finishes are generated: standard plus one per holographic effect and seven
assert.equal("finishes" in rawCatalog, false); assert.equal("finishes" in rawCatalog, false);
const preset = catalog.effectPresets.find((effect) => effect.id === "spectral-prism"); const preset = catalog.effectPresets.find((effect) => effect.id === "spectral-prism");
assert.equal(preset.kind, "holographic"); assert.equal(preset.kind, "holographic");
assert.deepEqual(catalog.finishes.map((finish) => finish.id), ["standard", ...["", "full-art-"].flatMap((format) => ["spectral-prism", "diffraction-sheen"].flatMap((effect) => ["rainbow", "solar", "dusk", "crimson", "nature", "aurora", "winter", "cosmic", "darkness"].map((palette) => `${format}${effect}-${palette}`)))]); assert.deepEqual(catalog.finishes.map((finish) => finish.id), ["standard", ...["", "full-art-"].flatMap((format) => ["spectral-prism", "diffraction-sheen", "prismatic-backdrop"].flatMap((effect) => ["rainbow", "solar", "dusk", "crimson", "nature", "aurora", "winter", "cosmic", "darkness"].map((palette) => `${format}${effect}-${palette}`)))]);
assert.deepEqual(catalog.finishes[0], { id: "standard", label: "Standard", effectPresetId: null, paletteId: null, formatId: "standard" }); assert.deepEqual(catalog.finishes[0], { id: "standard", label: "Standard", effectPresetId: null, paletteId: null, formatId: "standard" });
assert.ok(catalog.finishes.every((finish) => !("particlePresetId" in finish))); assert.ok(catalog.finishes.every((finish) => !("particlePresetId" in finish)));
assert.ok(catalog.effectPalettes.every((palette) => palette.colors.length === 7 && new Set(palette.colors).size === 7)); assert.ok(catalog.effectPalettes.every((palette) => palette.colors.length === 7 && new Set(palette.colors).size === 7));
@ -245,7 +255,7 @@ test("finishes are generated: standard plus one per holographic effect and seven
withNewEffect.effectPresets.push({ id: "effect-x", kind: "holographic", label: "Effet X" }); withNewEffect.effectPresets.push({ id: "effect-x", kind: "holographic", label: "Effet X" });
withNewEffect.effectPalettes.push({ id: "ember", label: "Braise", colors: ["#7f1d1d", "#b91c1c", "#ef4444", "#f97316", "#fb923c", "#fdba74", "#fff7ed"], highlight: "#ffffff" }); withNewEffect.effectPalettes.push({ id: "ember", label: "Braise", colors: ["#7f1d1d", "#b91c1c", "#ef4444", "#f97316", "#fb923c", "#fdba74", "#fff7ed"], highlight: "#ffffff" });
const generated = prepareVersionedCatalog(withNewEffect).finishes; const generated = prepareVersionedCatalog(withNewEffect).finishes;
assert.equal(generated.length, 1 + 2 * 3 * 10); assert.equal(generated.length, 1 + 2 * 4 * 10);
assert.deepEqual(generated.find((finish) => finish.id === "effect-x-ember"), { id: "effect-x-ember", label: "Effet X — Braise", effectPresetId: "effect-x", paletteId: "ember", formatId: "standard" }); assert.deepEqual(generated.find((finish) => finish.id === "effect-x-ember"), { id: "effect-x-ember", label: "Effet X — Braise", effectPresetId: "effect-x", paletteId: "ember", formatId: "standard" });
const invalidPalette = structuredClone(rawCatalog); const invalidPalette = structuredClone(rawCatalog);

View file

@ -47,6 +47,11 @@
"id": "diffraction-sheen", "id": "diffraction-sheen",
"kind": "holographic", "kind": "holographic",
"label": "Reflet diffractif" "label": "Reflet diffractif"
},
{
"id": "prismatic-backdrop",
"kind": "holographic",
"label": "Écrin prismatique"
} }
], ],
"cardFormats": [ "cardFormats": [
@ -940,7 +945,9 @@
"name": "La Pioche Mythique", "name": "La Pioche Mythique",
"description": "On raconte que le Dragon du Néant Étoilé resta sans voix devant une carte mythique. Depuis, il ouvre chaque booster avec le même espoir.", "description": "On raconte que le Dragon du Néant Étoilé resta sans voix devant une carte mythique. Depuis, il ouvre chaque booster avec le même espoir.",
"image": "/static/img/cards/astral-genesis/legendary/mythic_card_pull.webp", "image": "/static/img/cards/astral-genesis/legendary/mythic_card_pull.webp",
"fullImage": "/static/img/cards/astral-genesis/legendary/mythic_card_pull__full.webp" "cutoutImage": "/static/img/cards/astral-genesis/legendary/mythic_card_pull__cutout.webp",
"fullImage": "/static/img/cards/astral-genesis/legendary/mythic_card_pull__full.webp",
"fullCutoutImage": "/static/img/cards/astral-genesis/legendary/mythic_card_pull__full__cutout.webp"
}, },
{ {
"id": "crimson-card-trade", "id": "crimson-card-trade",

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 KiB

View file

@ -4,6 +4,8 @@ import { CollectionCardBack } from "./CollectionCardBack.jsx";
import { MATCH_HOLO_PALETTE_ID, MATCH_HOLO_PALETTE_LABEL, resolveMythicOpeningStyle, resolveOpeningEffect } from "./openingEffects.js"; import { MATCH_HOLO_PALETTE_ID, MATCH_HOLO_PALETTE_LABEL, resolveMythicOpeningStyle, resolveOpeningEffect } from "./openingEffects.js";
const STANDARD_CARD_LAYOUT = "standard"; const STANDARD_CARD_LAYOUT = "standard";
// Effets holographiques peints sous l'illustration, visibles seulement à travers ses zones transparentes.
const UNDERLAY_EFFECTS = new Set(["prismatic-backdrop"]);
function useCardTilt() { function useCardTilt() {
const cardRef = useRef(null); const cardRef = useRef(null);
@ -188,7 +190,9 @@ function CardFace({ entry, quantity, visual, size }) {
// Pleine illustration : l'image remplit la carte et seul le nom reste, gravé par-dessus. // Pleine illustration : l'image remplit la carte et seul le nom reste, gravé par-dessus.
const fullArt = visual.layout !== STANDARD_CARD_LAYOUT; const fullArt = visual.layout !== STANDARD_CARD_LAYOUT;
const showDetails = size === "lg" && !fullArt; const showDetails = size === "lg" && !fullArt;
const image = (fullArt && card.fullImage) || card.image; // Les effets à sous-couche préfèrent l'illustration à zones vides (`__cutout`) : la sous-couche apparaît à travers ses vides.
const cutout = UNDERLAY_EFFECTS.has(visual.effectPreset?.id) && (fullArt ? card.fullCutoutImage : card.cutoutImage);
const image = cutout || (fullArt && card.fullImage) || card.image;
return <div return <div
className="nebula-card-face" className="nebula-card-face"
data-card-layout={visual.layout} data-card-layout={visual.layout}
@ -197,7 +201,11 @@ function CardFace({ entry, quantity, visual, size }) {
data-holo-effect={visual.effectPreset?.id} data-holo-effect={visual.effectPreset?.id}
data-holo-palette={visual.palette?.id} data-holo-palette={visual.palette?.id}
> >
<div className={`nebula-card-art ${image ? "has-image" : ""}`} aria-hidden="true">{image ? <img src={image} alt="" loading={size === "lg" ? "eager" : "lazy"} decoding="async" /> : <span className="nebula-card-placeholder-mark" />}</div> <div className={`nebula-card-art ${image ? "has-image" : ""}`} aria-hidden="true">
{/* Sous-couche holographique : peinte sous l'illustration, elle n'apparaît qu'à travers ses zones transparentes. */}
{UNDERLAY_EFFECTS.has(visual.effectPreset?.id) && <span className="nebula-card-holo-underlay" />}
{image ? <img src={image} alt="" loading={size === "lg" ? "eager" : "lazy"} decoding="async" /> : <span className="nebula-card-placeholder-mark" />}
</div>
{showName && <h3><span>{card.name}</span></h3>} {showName && <h3><span>{card.name}</span></h3>}
{showDetails && <div className="nebula-card-copy"> {showDetails && <div className="nebula-card-copy">
<p>{card.description}</p> <p>{card.description}</p>

View file

@ -52,7 +52,8 @@ function OpeningEffectPreview({ catalog, lookup, effect }) {
function HolographicEffectPreview({ catalog, effect, editions, previewCard }) { function HolographicEffectPreview({ catalog, effect, editions, previewCard }) {
const finishes = catalog.finishes.filter((finish) => finish.effectPresetId === effect.id); const finishes = catalog.finishes.filter((finish) => finish.effectPresetId === effect.id);
const [paletteId, setPaletteId] = useState(finishes[0]?.paletteId || catalog.effectPalettes[0]?.id || ""); const [paletteId, setPaletteId] = useState(finishes[0]?.paletteId || catalog.effectPalettes[0]?.id || "");
const [formatId, setFormatId] = useState("standard"); // Un effet à sous-couche s'ouvre en pleine illustration quand la carte en a une version à zones vides et pas la version standard.
const [formatId, setFormatId] = useState(effect.id === "prismatic-backdrop" && previewCard.fullCutoutImage && !previewCard.cutoutImage ? "full-art" : "standard");
// Chaque combinaison format × effet × palette existe déjà comme finition générée. // Chaque combinaison format × effet × palette existe déjà comme finition générée.
const finishId = finishes.find((finish) => finish.paletteId === paletteId && finish.formatId === formatId)?.id || finishes[0]?.id; const finishId = finishes.find((finish) => finish.paletteId === paletteId && finish.formatId === formatId)?.id || finishes[0]?.id;
const edition = { id: `admin-effect-preview-${effect.id}`, cardId: previewCard.id, rarity: "mythic", finishIds: [finishId], promotional: false }; const edition = { id: `admin-effect-preview-${effect.id}`, cardId: previewCard.id, rarity: "mythic", finishIds: [finishId], promotional: false };

View file

@ -242,6 +242,34 @@ button.nebula-card { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { @media (hover: hover) and (pointer: fine) {
.nebula-card[data-holo-effect="diffraction-sheen"]:hover .nebula-card-face, .nebula-card[data-holo-effect="diffraction-sheen"]:focus-visible .nebula-card-face { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 18px 38px color-mix(in srgb, var(--holo-4) 16%, transparent), var(--shadow-md); } .nebula-card[data-holo-effect="diffraction-sheen"]:hover .nebula-card-face, .nebula-card[data-holo-effect="diffraction-sheen"]:focus-visible .nebula-card-face { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 18px 38px color-mix(in srgb, var(--holo-4) 16%, transparent), var(--shadow-md); }
} }
/* Écrin prismatique : deux niveaux. Sous l'illustration, un film irisé opaque n'apparaît qu'à travers les zones transparentes
de l'image ; par-dessus, une surcouche discrète fait seulement briller la carte. Tout suit le tilt, sans animation. */
.nebula-card-holo-underlay { position: absolute; inset: 0; display: none; pointer-events: none; }
.nebula-card[data-holo-effect="prismatic-backdrop"] { --backdrop-angle: calc(128deg + var(--card-tilt-y) * 4 - var(--card-tilt-x) * 3); --backdrop-gloss-rest: 0.06; }
.nebula-card[data-holo-effect="prismatic-backdrop"] .nebula-card-holo-underlay {
display: block;
/* De haut en bas : point lumineux, voile nacré, trame diamant du film, interférences, puis bandes irisées répétées. */
background-image:
radial-gradient(circle at var(--card-pointer-x) var(--card-pointer-y), color-mix(in srgb, var(--holo-highlight) 70%, transparent), transparent 36%),
linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3)),
repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.5) 0 1px, transparent 1px 4px),
repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.5) 0 1px, transparent 1px 4px),
repeating-linear-gradient(calc(var(--backdrop-angle) - 72deg), var(--holo-4) 0%, var(--holo-6) 4%, var(--holo-1) 8%, var(--holo-3) 12%, var(--holo-5) 16%, var(--holo-7) 20%, var(--holo-2) 24%, var(--holo-4) 28%),
repeating-linear-gradient(var(--backdrop-angle), var(--holo-1) 0%, var(--holo-2) 6%, var(--holo-3) 12%, var(--holo-4) 18%, var(--holo-5) 24%, var(--holo-6) 30%, var(--holo-7) 36%, var(--holo-1) 42%);
background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 160% 160%, 180% 180%;
background-position: 0 0, 0 0, 0 0, 0 0, var(--card-pointer-x) var(--card-pointer-y), calc(100% - var(--card-pointer-x)) calc(100% - var(--card-pointer-y));
background-blend-mode: screen, soft-light, overlay, overlay, soft-light, normal;
filter: saturate(0.9) brightness(1.06);
}
.nebula-card[data-holo-effect="prismatic-backdrop"] .nebula-card-holo-layer { transition: none; }
.nebula-card[data-holo-effect="prismatic-backdrop"] .nebula-card-holo-primary { opacity: calc(0.05 + var(--card-tilt-energy) * 0.16); background-image: linear-gradient(var(--backdrop-angle), var(--holo-1), var(--holo-3), var(--holo-5), var(--holo-7), var(--holo-2), var(--holo-4), var(--holo-6)); background-size: 240% 240%; background-position: var(--card-pointer-x) var(--card-pointer-y); mix-blend-mode: overlay; }
.nebula-card[data-holo-effect="prismatic-backdrop"] .nebula-card-holo-secondary { opacity: calc(var(--backdrop-gloss-rest) + var(--card-tilt-energy) * 0.42); background-image: linear-gradient(var(--backdrop-angle), transparent 34%, color-mix(in srgb, var(--holo-highlight) 55%, white) 50%, transparent 66%); background-size: 260% 260%; background-position: calc(100% - var(--card-pointer-x)) calc(100% - var(--card-pointer-y)); mix-blend-mode: soft-light; }
@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
.nebula-card[data-holo-effect="prismatic-backdrop"] { --backdrop-gloss-rest: 0.22; }
}
@media (hover: hover) and (pointer: fine) {
.nebula-card[data-holo-effect="prismatic-backdrop"]:hover .nebula-card-face, .nebula-card[data-holo-effect="prismatic-backdrop"]:focus-visible .nebula-card-face { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1), 0 18px 38px color-mix(in srgb, var(--holo-4) 16%, transparent), var(--shadow-md); }
}
.nebula-card-reveal:focus-visible, .nebula-card-select:focus-visible { outline: 3px solid var(--color-accent-gold); outline-offset: 5px; } .nebula-card-reveal:focus-visible, .nebula-card-select:focus-visible { outline: 3px solid var(--color-accent-gold); outline-offset: 5px; }
.nebula-card-particles { position: absolute; inset: 50%; z-index: 8; color: var(--opening-aura, var(--card-rarity, var(--color-primary))); pointer-events: none; } .nebula-card-particles { position: absolute; inset: 50%; z-index: 8; color: var(--opening-aura, var(--card-rarity, var(--color-primary))); pointer-events: none; }
.nebula-card-reveal[data-reveal-phase="revealed"] .nebula-card-particles { display: none; } .nebula-card-reveal[data-reveal-phase="revealed"] .nebula-card-particles { display: none; }