The effects move out of Board.svelte into src/fx-sprites/ — one component per flourish, markup and animation CSS together, so editing the fireball means opening Fireball.svelte and nothing else. A registry (index.ts) maps kind to sprite; Board renders through it. The event mapping stays in fx.ts. And a viewer: /?fx opens the Flourish Workshop — every sprite on a labeled parchment tile, replaying on a 2.2-second beat. Under the dev server, editing any sprite file hot-reloads the gallery mid-loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
23 lines
609 B
Svelte
23 lines
609 B
Svelte
<script lang="ts">
|
|
import type { FxOf } from "../fx";
|
|
import { center } from "./geom";
|
|
let { fx }: { fx: FxOf<"absorb"> } = $props();
|
|
const c = $derived(center(fx.at));
|
|
</script>
|
|
|
|
<rect x={c.x - 9} y={c.y - 13} width="18" height="26" rx="2" class="absorb"
|
|
style={`transform-origin: ${c.x}px ${c.y}px`} />
|
|
|
|
<style>
|
|
.absorb {
|
|
fill: #f6f0df;
|
|
stroke: #43331f;
|
|
stroke-width: 1.5;
|
|
animation: swallow 0.65s ease-in forwards;
|
|
}
|
|
@keyframes swallow {
|
|
0% { opacity: 0.95; transform: scale(1) rotate(0deg); }
|
|
100% { opacity: 0; transform: scale(0.05) rotate(50deg); }
|
|
}
|
|
</style>
|