Replace the prismatic backdrop with a prismatic parallax and redraw the Long Night legendaries
The prismatic-backdrop finish, now labelled « Parallaxe prismatique », lays a card's cut-out hero over a backdrop without it and shifts both with the tilt, the palette tinting the backdrop, lighting each layer's highlights and fringing the hero. Cards declare the backdrop next to the cutout (backdropImage, fullBackdropImage), validated by name. The Visual Lab is back to its usual effect cards. The three Long Night legendaries are redrawn in the collection's style, and La Pioche Mythique gets its parallax layers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3f70a5638d
commit
efdb5c558c
27 changed files with 279 additions and 50 deletions
|
|
@ -4,8 +4,8 @@ import { CollectionCardBack } from "./CollectionCardBack.jsx";
|
|||
import { MATCH_HOLO_PALETTE_ID, MATCH_HOLO_PALETTE_LABEL, resolveMythicOpeningStyle, resolveOpeningEffect } from "./openingEffects.js";
|
||||
|
||||
const STANDARD_CARD_LAYOUT = "standard";
|
||||
// Effets holographiques peints sous l'illustration, visibles seulement à travers ses zones transparentes.
|
||||
const UNDERLAY_EFFECTS = new Set(["prismatic-backdrop"]);
|
||||
// Effets holographiques qui découpent l'illustration en calques de parallaxe (décor, puis héros détouré).
|
||||
const PARALLAX_EFFECTS = new Set(["prismatic-backdrop"]);
|
||||
|
||||
function useCardTilt() {
|
||||
const cardRef = useRef(null);
|
||||
|
|
@ -35,6 +35,9 @@ function useCardTilt() {
|
|||
card.style.setProperty("--card-lift", `${current.lift.toFixed(2)}px`);
|
||||
card.style.setProperty("--card-pointer-x", `${current.pointerX.toFixed(1)}%`);
|
||||
card.style.setProperty("--card-pointer-y", `${current.pointerY.toFixed(1)}%`);
|
||||
// Tilt normalisé (-1 à 1) : +1 quand le pointeur est au bord droit ou au bord bas. Les calques de parallaxe s'en servent.
|
||||
card.style.setProperty("--card-tilt-nx", (current.y / 5).toFixed(3));
|
||||
card.style.setProperty("--card-tilt-ny", (-current.x / 4).toFixed(3));
|
||||
// Énergie du tilt (0 à 1) : nulle au repos, modérée sur une carte à plat, maximale sur les bords.
|
||||
const engaged = Math.min(1, current.lift / -4);
|
||||
const inclination = Math.min(1, Math.hypot(current.x / 4, current.y / 5));
|
||||
|
|
@ -96,6 +99,22 @@ function useCardTilt() {
|
|||
|
||||
return cardRef;
|
||||
}
|
||||
|
||||
// Calques de parallaxe, deux au plus : le décor sans le héros puis le héros détouré. `depth` vaut 1 au fond, 0 au plan de la
|
||||
// carte et devient négatif devant. Sans plaque de décor, le composite la remplace (mode de compatibilité) ; sans héros détouré,
|
||||
// l'illustration reste un seul plan immobile, qui garde le prisme de la palette.
|
||||
function resolveParallaxLayers(card, fullArt, compositeImage) {
|
||||
const cutout = fullArt ? card.fullCutoutImage : card.cutoutImage;
|
||||
const backdrop = fullArt ? card.fullBackdropImage : card.backdropImage;
|
||||
if (!cutout) return compositeImage ? { setup: "flat", layers: [{ id: "backdrop", role: "backdrop", depth: 0, src: compositeImage }] } : null;
|
||||
return {
|
||||
setup: backdrop ? "clean" : "compat",
|
||||
layers: [
|
||||
{ id: "backdrop", role: "backdrop", depth: 1, src: backdrop || compositeImage },
|
||||
{ id: "subject", role: "subject", depth: -0.2, src: cutout }
|
||||
]
|
||||
};
|
||||
}
|
||||
function RaritySymbol({ rarity, label }) {
|
||||
return <span className="nebula-card-rarity-symbol" data-rarity={rarity} title={label}>
|
||||
<svg viewBox="0 0 32 32" aria-hidden="true">
|
||||
|
|
@ -195,9 +214,9 @@ function CardFace({ entry, quantity, visual, size }) {
|
|||
// Pleine illustration : l'image remplit la carte et seul le nom reste, gravé par-dessus.
|
||||
const fullArt = visual.layout !== STANDARD_CARD_LAYOUT;
|
||||
const showDetails = size === "lg" && !fullArt;
|
||||
// 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;
|
||||
const image = (fullArt && card.fullImage) || card.image;
|
||||
const parallax = PARALLAX_EFFECTS.has(visual.effectPreset?.id) ? resolveParallaxLayers(card, fullArt, image) : null;
|
||||
const loading = size === "lg" ? "eager" : "lazy";
|
||||
return <div
|
||||
className="nebula-card-face"
|
||||
data-card-layout={visual.layout}
|
||||
|
|
@ -206,10 +225,19 @@ function CardFace({ entry, quantity, visual, size }) {
|
|||
data-holo-effect={visual.effectPreset?.id}
|
||||
data-holo-palette={visual.palette?.id}
|
||||
>
|
||||
<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 className={`nebula-card-art ${image ? "has-image" : ""}`} data-parallax-setup={parallax?.setup} aria-hidden="true">
|
||||
{/* Chaque calque porte sa profondeur ; son image sert aussi de masque au reflet prismatique qui ne touche que lui. */}
|
||||
{parallax ? parallax.layers.map((layer, index) => <span
|
||||
key={layer.id}
|
||||
className="nebula-card-depth-layer"
|
||||
data-depth-layer={layer.id}
|
||||
data-depth-role={layer.role}
|
||||
style={{ "--layer-depth": layer.depth, "--layer-depth-abs": Math.abs(layer.depth), "--layer-index": index, "--layer-image": `url("${layer.src}")`, zIndex: index }}
|
||||
>
|
||||
<img src={layer.src} alt="" loading={loading} decoding="async" />
|
||||
{layer.role === "backdrop" && <span className="nebula-card-depth-tint" />}
|
||||
<span className="nebula-card-depth-foil" />
|
||||
</span>) : image ? <img src={image} alt="" loading={loading} decoding="async" /> : <span className="nebula-card-placeholder-mark" />}
|
||||
</div>
|
||||
{showName && <h3><span>{card.name}</span></h3>}
|
||||
{showDetails && <div className="nebula-card-copy">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue