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:
parent
9f70bea523
commit
f77a0ca577
15 changed files with 1779 additions and 16 deletions
|
|
@ -2,6 +2,7 @@
|
|||
import { useState } from "react";
|
||||
import { NebulaCard } from "../NebulaCard.jsx";
|
||||
import { MATCH_HOLO_PALETTE_ID, MATCH_HOLO_PALETTE_LABEL, withCardOpeningSetting } from "../openingEffects.js";
|
||||
import { flareEditionFields, NO_FLARE } from "../holoFlares.js";
|
||||
import { DEFAULT_TUNING, tuningEditionFields } from "./effectTuning.js";
|
||||
import { availableEffects, fittingFormat } from "./finishAvailability.js";
|
||||
import { SwatchDropdown } from "./SwatchDropdown.jsx";
|
||||
|
|
@ -61,7 +62,7 @@ function HolographicBench({ catalog, effects: allEffects, previewCard }) {
|
|||
const [effectId, setEffectId] = useState(effects[0]?.effect.id || "");
|
||||
const [value, setValue] = useState(() => {
|
||||
const finish = catalog.finishes.find((item) => item.effectPresetId === effectId);
|
||||
return { formatId: "standard", paletteId: finish?.paletteId || catalog.effectPalettes[0]?.id || "", intensity: DEFAULT_TUNING, level: DEFAULT_TUNING };
|
||||
return { formatId: "standard", paletteId: finish?.paletteId || catalog.effectPalettes[0]?.id || "", intensity: DEFAULT_TUNING, level: DEFAULT_TUNING, flare: NO_FLARE };
|
||||
});
|
||||
const { effect, editions } = effects.find((item) => item.effect.id === effectId) || effects[0] || {};
|
||||
if (!effect) return null;
|
||||
|
|
@ -70,7 +71,7 @@ function HolographicBench({ catalog, effects: allEffects, previewCard }) {
|
|||
const formatId = fittingFormat(catalog, previewCard, preset.id, value.formatId);
|
||||
const finish = catalog.finishes.find((item) => item.effectPresetId === preset.id && item.paletteId === value.paletteId && item.formatId === formatId)
|
||||
|| catalog.finishes.find((item) => item.effectPresetId === preset.id);
|
||||
return { id: `admin-effect-preview-${preset.id}`, cardId: previewCard.id, rarity: "mythic", finishIds: [finish?.id], promotional: false, ...tuningEditionFields(preset, value) };
|
||||
return { id: `admin-effect-preview-${preset.id}`, cardId: previewCard.id, rarity: "mythic", finishIds: [finish?.id], promotional: false, ...tuningEditionFields(preset, value), ...flareEditionFields(value.flare) };
|
||||
};
|
||||
|
||||
return <div className="nds-card nebula-admin-lab-bench">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// (vitesse, amplitude, taille des éclats) quand le catalogue lui en déclare un. Le niveau 3 est le rendu de référence.
|
||||
import { DEFAULT_TUNING } from "./effectTuning.js";
|
||||
|
||||
function TuningRange({ scale, value, disabled, onChange }) {
|
||||
export function TuningRange({ scale, value, disabled, onChange }) {
|
||||
const valueLabel = scale.levels[value - 1];
|
||||
return <label className="nebula-admin-tuning-range">
|
||||
<span>{scale.label}<span className="nebula-admin-tuning-value">{valueLabel}</span></span>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
import { useState } from "react";
|
||||
import { SelectDropdown } from "../../../components/SelectDropdown.jsx";
|
||||
import { Tabs } from "../../../components/Tabs.jsx";
|
||||
import { EffectTuningFields } from "./EffectTuningFields.jsx";
|
||||
import { DEFAULT_FLARE_SCOPE, DEFAULT_FLARE_TUNING, FLARE_EFFECTS, FLARE_SCOPES, MATCH_HOLO_FLARE_LABEL, MATCH_HOLO_FLARE_PALETTE } from "../holoFlares.js";
|
||||
import { EffectTuningFields, TuningRange } from "./EffectTuningFields.jsx";
|
||||
import { variationSummary } from "./effectTuning.js";
|
||||
import { effectMissingHint, fittingFormat, formatMissingHint } from "./finishAvailability.js";
|
||||
import { SwatchDropdown } from "./SwatchDropdown.jsx";
|
||||
|
|
@ -16,6 +17,8 @@ const enabledFirst = (left, right) => Number(left.disabled) - Number(right.disab
|
|||
// `value` : { formatId, effectPresetId, paletteId, intensity, level }. `showEffect` masque le menu d'effet quand l'effet se
|
||||
// choisit ailleurs (miniatures de l'Atelier). Un format ou un effet dont la carte n'a pas les fichiers reste visible mais
|
||||
// désactivé, en bas de liste, avec la liste des fichiers manquants.
|
||||
// `value.flare` ({ id, motifId, paletteId, scope, intensity, level, count }) rend l'onglet Particules réglable ; sans lui (éditeur des variations,
|
||||
// tant que les particules ne s'enregistrent pas), l'onglet reste en lecture seule.
|
||||
// `children` reçoit les actions (Enregistrer, Annuler) sous le résumé.
|
||||
export function VariationCustomizer({ catalog, card, value, showEffect = true, disabled = false, notice = null, onChange, children = null }) {
|
||||
const [tab, setTab] = useState("holo");
|
||||
|
|
@ -29,6 +32,9 @@ export function VariationCustomizer({ catalog, card, value, showEffect = true, d
|
|||
const hint = effectMissingHint(catalog, card, item.id);
|
||||
return { value: item.id, label: item.label, disabled: Boolean(hint), hint };
|
||||
}).toSorted(enabledFirst);
|
||||
const flare = value.flare;
|
||||
const flareEffect = FLARE_EFFECTS.find((item) => item.id === flare?.id);
|
||||
const changeFlare = (next) => onChange({ ...value, flare: { ...flare, ...next } });
|
||||
const changeEffect = (effectPresetId) => onChange({ ...value, effectPresetId, formatId: fittingFormat(catalog, card, effectPresetId, value.formatId) });
|
||||
return <div className="nebula-admin-customizer">
|
||||
<Tabs className="nebula-admin-customizer-tabs" tabs={TABS} activeTab={tab} onChange={setTab} />
|
||||
|
|
@ -40,9 +46,19 @@ export function VariationCustomizer({ catalog, card, value, showEffect = true, d
|
|||
<SwatchDropdown className="nebula-admin-inline-field" label="Palette" accessibleLabel="Palette holographique" value={value.paletteId} options={catalog.effectPalettes} disabled={disabled} onChange={(paletteId) => onChange({ ...value, paletteId })} />
|
||||
</div>
|
||||
<EffectTuningFields catalog={catalog} effect={effect} value={value} disabled={disabled} onChange={(tuning) => onChange({ ...value, ...tuning })} />
|
||||
</> : flare ? <>
|
||||
<div className="nebula-admin-customizer-choices">
|
||||
<SelectDropdown className="nebula-admin-inline-field" label="Animation" size="sm" value={flare.id} disabled={disabled} options={[{ value: "", label: "Aucune" }, ...FLARE_EFFECTS.map((item) => ({ value: item.id, label: item.label }))]} onChange={(id) => changeFlare({ id })} />
|
||||
{flareEffect?.motifs && <SelectDropdown className="nebula-admin-inline-field" label="Motif" size="sm" value={flareEffect.motifs.some((item) => item.id === flare.motifId) ? flare.motifId : flareEffect.motifs[0].id} disabled={disabled} options={flareEffect.motifs.map((item) => ({ value: item.id, label: item.label }))} onChange={(motifId) => changeFlare({ motifId })} />}
|
||||
{flareEffect && <SwatchDropdown className="nebula-admin-inline-field" label="Palette" accessibleLabel="Palette des particules" value={flare.paletteId} options={[{ id: MATCH_HOLO_FLARE_PALETTE, label: MATCH_HOLO_FLARE_LABEL }, ...catalog.effectPalettes]} disabled={disabled} onChange={(paletteId) => changeFlare({ paletteId })} />}
|
||||
{flareEffect && <SelectDropdown className="nebula-admin-inline-field" label="Zone" size="sm" value={flare.scope || DEFAULT_FLARE_SCOPE} disabled={disabled} options={FLARE_SCOPES.map((item) => ({ value: item.id, label: item.label }))} onChange={(scope) => changeFlare({ scope })} />}
|
||||
</div>
|
||||
{flareEffect && <div className="nebula-admin-tuning">
|
||||
{flareEffect.tunings.map((scale) => <TuningRange key={scale.key} scale={scale} value={flare[scale.key] || DEFAULT_FLARE_TUNING} disabled={disabled} onChange={(next) => changeFlare({ [scale.key]: next })} />)}
|
||||
</div>}
|
||||
</> : <>
|
||||
<SelectDropdown className="nebula-admin-inline-field" label="Animation" size="sm" disabled value="" options={[{ value: "", label: "Aucune" }]} onChange={() => {}} />
|
||||
<p className="nebula-form-help">Les animations de particules arrivent une par une.</p>
|
||||
<p className="nebula-form-help">Les particules s’essaient d’abord dans l’Atelier visuel ; elles s’enregistreront ici une fois validées.</p>
|
||||
</>}
|
||||
</div>
|
||||
{notice}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
// Rôle : valeurs communes des paliers d'une variation mythique (intensité de la palette, palier propre à l'effet), de 1 à 5,
|
||||
// et résumé d'une ligne de ses réglages.
|
||||
import { FLARE_EFFECTS } from "../holoFlares.js";
|
||||
|
||||
export const DEFAULT_TUNING = 3;
|
||||
|
||||
// Un palier central n'est pas transmis : la carte garde son rendu de référence, sans attribut.
|
||||
|
|
@ -24,6 +26,6 @@ export function variationSummary(catalog, card, value) {
|
|||
card.fullImage && format?.label,
|
||||
`${catalog.effectIntensity.label} ${lower(intensity)}`,
|
||||
effect?.level && `${effect.level.label} ${lower(effect.level.levels[(value.level ?? DEFAULT_TUNING) - 1])}`,
|
||||
"Particules : aucune"
|
||||
`Particules : ${lower(FLARE_EFFECTS.find((item) => item.id === value.flare?.id)?.label) || "aucune"}`
|
||||
].filter(Boolean).join(" · ");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue