Open source CapCut alternative.
TypeScript
"use client";
import { erodeMask } from "./textureCss";
import { useTranslations } from "next-intl";
import { useEffect, useRef, useState } from "react";
import {
countText,
evalOverlayAnim,
glyphStateAt,
hasGlyphMotion,
isGlyphAnimStyle,
isGlyphLoopStyle,
HOLD_IDS,
MOTION,
presetExtent,
sampleProperties,
slotReel,
slotSeed,
TEXT_ONLY_ANIM_STYLE_IDS,
OVERLAY_ANIM_STYLE_IDS,
OVERLAY_ANIM_STYLE_LABELS,
OVERLAY_LOOP_STYLE_IDS,
OVERLAY_LOOP_STYLE_LABELS,
OVERLAY_HIT_STYLE_IDS,
OVERLAY_HIT_STYLE_LABELS,
wordDrawsAt,
wordEffectIdsIn,
WORD_ACCENT_DEFAULT,
WORD_EFFECT_LABELS,
WORD_FAMILIES,
type OverlayAnimStyle,
type OverlayLoopStyle,
type OverlayWords,
zapSeed,
} from "@donkeycut/effects-kit";
import { Tile } from "@/cut/components/PanelTile";
import { SectionTitle } from "@/cut/components/SectionTitle";
import { wordDrawCss } from "@/cut/lib/textRender";
import { fontStack } from "@/cut/lib/types";
import { useLabels } from "@/i18n/labels";
import type { Messages } from "@/i18n/namespaces";
/**
* The animation picker: a grid of tiles, each playing its style on the style's
* own name — the grid reads as what every motion does without asking the
* reader to hunt for it. The names wear one heavy face across every tile, so
* what changes from tile to tile is the motion. A card outside the picker
* holds its name still until the pointer reaches it.
*
* Playback samples `evalOverlayAnim` — the same function the preview, the
* in-tab export and the frame sampler use — so a tile can't promise motion the
* export won't play. A new style draws itself here the moment the evaluator
* learns it.
*/
/** Rest beat between demo ramps. An exit clears the stage for its whole ramp,
* and a per-glyph ramp leaves a couple of letters scattered for most of it, so
* the demo rests for a multiple of the ramp it just played: the tile shows the
* name it is offering roughly three quarters of the time. */
const DEMO_HOLD = 1.4;
const HOLD_RATIO = 2.6;
const demoCycle = (ramp: number) => ramp + Math.max(DEMO_HOLD, ramp * HOLD_RATIO);
/** How far apart in its cycle each tile starts from the one before it. The
* golden ratio spreads any run of tiles evenly around the cycle, so the few
* that are mid-motion at a given moment are scattered through the grid. */
export const PHASE_STEP = 0.618;
/** The cycle a loop tile steps against; loops hold the name the whole way
* round, so this only has to look unsynchronised. */
const LOOP_SPREAD = 1.2;
/** Design px that map to the tile's preview stage. The evaluator works in px at
* a 1080 short side; a slide travels 120 of them, which has to read inside a
* stage a few dozen pixels wide. Low enough that a slide clearly leaves. */
const DEMO_REFERENCE_PX = 190;
/** A loop's travel is a fraction of a slide's — a float bobs 12 design px — so
* it maps against a shorter reference and stays visible at tile size. */
const LOOP_REFERENCE_PX = 64;
/** The share of the tile the widest part of a move is drawn at. Small enough
* that the name is still inside the card at the far end of the travel. */
const MOVE_REACH = 0.15;
/** A move is mapped against its own reach: the holds run from a breath that
* never leaves the spot to a fall the depth of the frame, and one fixed
* mapping either loses the small ones or throws the big ones clean off the
* tile. Every move then reads at the same amplitude, and what tells them
* apart in the grid is the shape of the motion. */
const moveReferencePx = (style: string) => {
const preset = MOTION.holds[style];
const travel = preset ? presetExtent(preset).travel : 0;
return Math.max(LOOP_REFERENCE_PX, travel / MOVE_REACH);
};
const referencePx = (slot: Slot, style: string) =>
slot === "move"
? moveReferencePx(style)
: slot === "loop"
? LOOP_REFERENCE_PX
: DEMO_REFERENCE_PX;
type Slot = "in" | "out" | "loop" | "move" | "words" | "hit";
/** A move runs the element's whole span, so the tile gives it one of its own
* to play in — long enough to read a push, short enough to come round again. */
const MOVE_DEMO_SECONDS = 2.4;
type HoldId = keyof Messages["inspector"]["holds"];
/** Names a slot's style in the page's language. The registries say which ids
* are known; an id none of them knows reads as itself. */
function useSlotLabel(): (slot: Slot, style: string) => string {
const t = useTranslations("inspector.holds");
const hitLabel = useLabels("overlayHit");
const wordLabel = useLabels("wordEffect");
const loopLabel = useLabels("overlayLoop");
const animLabel = useLabels("overlayAnim");
return (slot, style) => {
if (slot === "hit") {
return style in OVERLAY_HIT_STYLE_LABELS ? hitLabel(style) : style;
}
if (slot === "words") {
return style in WORD_EFFECT_LABELS ? wordLabel(style) : style;
}
if (slot === "move") {
return MOTION.holds[style] ? t(style as HoldId) : style;
}
if (slot === "loop") {
return style in OVERLAY_LOOP_STYLE_LABELS ? loopLabel(style) : style;
}
return style in OVERLAY_ANIM_STYLE_LABELS ? animLabel(style) : style;
};
}
function demoStateAt(
slot: Slot,
style: string,
t: number,
isText: boolean,
ramp: number,
speed: number
) {
if (slot === "move") {
// A move plays over the element's whole span; the tile sweeps one demo
// window through it and hands back the same shape the ramps produce.
const preset = MOTION.holds[style];
if (!preset) return { dx: 0, dy: 0, scale: 1, rotate: 0, alpha: 1 };
const pose = sampleProperties(
preset.animate,
(t % MOVE_DEMO_SECONDS) / MOVE_DEMO_SECONDS,
MOVE_DEMO_SECONDS
);
return {
dx: pose.dx,
dy: pose.dy,
scale: (pose.sx + pose.sy) / 2,
rotate: pose.rotate,
alpha: pose.alpha,
};
}
if (slot === "loop") {
return evalOverlayAnim({ loop: { style: style as OverlayLoopStyle, speed } }, t, 60, isText);
}
if (slot === "hit") {
// A hit is one press and the rest beat after it, darkening as it will on
// the element.
const cycle = demoCycle(ramp);
return evalOverlayAnim(
{ hit: { style, at: 0, seconds: ramp, darken: true } },
t % cycle,
cycle,
isText
);
}
const cycle = demoCycle(ramp);
const local = t % cycle;
const anim =
slot === "in"
? { in: { style: style as OverlayAnimStyle, seconds: ramp } }
: { out: { style: style as OverlayAnimStyle, seconds: ramp } };
// The exit sits at the tail of the window, so an Out tile rests first and
// then leaves — the shape of the thing it is previewing.
return evalOverlayAnim(anim, local, cycle, isText);
}
// The stage is the card's own width with no frame of its own: the card is
// already one, and a second inside it would both box the motion in and steal
// the room the motion needs. Clipping is what sells a slide leaving.
const STAGE = "grid h-12 w-full place-items-center overflow-hidden";
const WORD = "text-[13px] whitespace-nowrap";
/** The one face every demo name wears: bold enough that a letter still reads
* mid-slide, open enough that a name fits the tile at 13px. */
const wordStyle = () => ({ fontFamily: fontStack("montserrat"), fontWeight: 700, lineHeight: 1 });
/** Whether the demo types its name out rather than moving it. A typed demo
* rewrites the element's text every frame, so React must render it with no
* children at all — a text node React still tracks would be destroyed under
* it, and the crash lands later, when the tile unmounts. */
const typesItsName = (slot: Slot, style: string) =>
slot === "in" || slot === "out" ? !!MOTION.edges[style]?.animate.typed : false;
/** Whether the demo counts a number up (count). Its element comes from React
* empty, for the reason a typed demo's does. */
const countsItsName = (slot: Slot, style: string) =>
slot === "in" || slot === "out" ? !!MOTION.edges[style]?.animate.counted : false;
/** The number a count demo counts to, after the style's name: "Count 100". */
const COUNT_DEMO_TO = 100;
/** Whether the demo rolls each letter up a reel (slot). The reel's three
* windows come from React empty, for the reason a typed demo's do. */
const rollsItsName = (slot: Slot, style: string) =>
slot === "in" || slot === "out" ? !!MOTION.edges[style]?.animate.roll : false;
/** Whether the demo flies into its own last letter (dive). */
const divesIntoName = (slot: Slot, style: string) =>
slot === "in" || slot === "out" ? !!MOTION.edges[style]?.animate.dive : false;
/** How far a dive demo zooms: the last letter's ink fills a tile well before
* the frame-sized flight the element takes. */
const DEMO_DIVE_MAX = 40;
/** Whether the demo has to lay the name out letter by letter: the per-glyph
* ramps and the per-glyph loops both move each character on its own delay. */
const splitsGlyphs = (slot: Slot, style: string) =>
slot === "move"
? false
: slot === "loop"
? isGlyphLoopStyle(style as OverlayLoopStyle)
: isGlyphAnimStyle(style as OverlayAnimStyle);
/** The name standing still: what a card wears until the pointer reaches it,
* and what every tile falls back to when the reader asks for less motion. */
function FrozenName({ slot, style }: { slot: Slot; style: string }) {
const labelOf = useSlotLabel();
return (
<span className={`${WORD} text-foreground`} style={wordStyle()}>
{labelOf(slot, style)}
</span>
);
}
/** The style's name playing its own animation. The frames write styles straight
* to the element: animating through React state would re-render the inspector
* every frame for pixels React has no say over. */
function LiveName({
slot,
style,
isText,
seconds,
speed,
index = 0,
}: {
slot: Slot;
style: string;
isText: boolean;
seconds: number;
speed: number;
/** Place in the grid. It sets where in its own cycle this demo starts, so a
* grid of them spreads out instead of running in unison. */
index?: number;
}) {
const ref = useRef<HTMLSpanElement>(null);
const labelOf = useSlotLabel();
const label = labelOf(slot, style);
const typed = typesItsName(slot, style);
const counts = countsItsName(slot, style);
const rolls = isText && rollsItsName(slot, style);
const dives = divesIntoName(slot, style);
// Golden-ratio steps around the cycle: neighbouring tiles land far apart in
// it, and no run of them ever bunches up mid-motion together.
const phase = index * (slot === "loop" ? LOOP_SPREAD : demoCycle(seconds)) * PHASE_STEP;
useEffect(() => {
const el = ref.current;
if (!el) return;
// A typed demo's element comes from React empty; its content is this
// effect's to write, starting with the whole name.
if (el.dataset.word) el.textContent = el.dataset.word;
const letters = () => Array.from(el.children) as HTMLElement[];
const chars = [...label];
/** A slot letter's reel, drawn into its empty windows. */
const drawReel = (kid: HTMLElement, i: number, roll: number) => {
const windows = kid.querySelectorAll<HTMLElement>("[data-reel]");
const reel = roll ? slotReel(chars[i] ?? "", i, roll, slotSeed(label)) : [{ ch: chars[i] ?? "", y: 0, alpha: 1 }];
windows.forEach((w, k) => {
const r = reel[k];
w.textContent = r ? r.ch : "";
w.style.transform = r ? `translate(-50%, ${r.y * 100}%)` : "";
w.style.opacity = r ? String(r.alpha) : "0";
});
};
const rest = () => {
el.style.transform = "";
el.style.transformOrigin = "";
el.style.opacity = "";
el.style.clipPath = "";
el.style.filter = "";
el.style.textShadow = "";
for (const prop of ["mask-image", "-webkit-mask-image"]) {
el.style.removeProperty(prop);
}
letters().forEach((kid, i) => {
kid.style.transform = "";
kid.style.opacity = "";
if (rolls) drawReel(kid, i, 0);
});
if (el.dataset.word) el.textContent = el.dataset.word;
};
// The reel windows come from React empty: the name goes in before
// anything moves.
if (rolls) letters().forEach((kid, i) => drawReel(kid, i, 0));
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return rest;
let start = 0;
let raf = 0;
// Whether the last frame left per-letter styles on the children. A ramp
// that ends off-stage leaves them at zero opacity, so the rest beat has to
// hand the letters back before the word can read again.
let glyphed = false;
const tick = (now: number) => {
if (!start) start = now;
const st = demoStateAt(slot, style, (now - start) / 1000 + phase, isText, seconds, speed);
const px = (v: number) => (v * el.clientWidth) / referencePx(slot, style);
if (hasGlyphMotion(st)) {
// The letters carry the motion; the word itself stays put.
const kids = letters();
kids.forEach((kid, i) => {
const g = glyphStateAt(st, i, kids.length);
kid.style.transform = `translate(${px(g.dx)}px, ${px(g.dy)}px) rotate(${g.rotate}deg) scale(${g.sx}, ${g.sy})`;
kid.style.opacity = String(g.alpha);
if (rolls) drawReel(kid, i, g.roll ?? 0);
});
glyphed = true;
} else {
if (glyphed) {
letters().forEach((kid, i) => {
kid.style.transform = "";
kid.style.opacity = "";
if (rolls) drawReel(kid, i, 0);
});
glyphed = false;
}
// A dive zooms the name about its last letter.
const last = dives ? letters().at(-1) : undefined;
el.style.transformOrigin = last
? `${last.offsetLeft + last.offsetWidth / 2}px ${last.offsetTop + last.offsetHeight / 2}px`
: "";
const zoom = st.dive ? Math.pow(DEMO_DIVE_MAX, st.dive) : 1;
el.style.transform = `translate(${px(st.dx)}px, ${px(st.dy)}px) rotate(${st.rotate}deg) scale(${st.scale * zoom})`;
el.style.opacity = String(st.alpha);
}
el.style.clipPath =
st.reveal !== undefined ? `inset(0 ${(1 - st.reveal) * 100}% 0 0)` : "";
// A disintegration eats the name through the kit's erosion tile.
const eroded = st.erode !== undefined && st.erode > 0 ? erodeMask(st.erode, null) : null;
for (const prop of ["mask-image", "-webkit-mask-image"]) {
el.style.setProperty(prop, eroded ? String(eroded.maskImage) : "");
}
for (const prop of ["mask-size", "-webkit-mask-size"]) {
el.style.setProperty(prop, eroded ? "100% 100%" : "");
}
for (const prop of ["mask-repeat", "-webkit-mask-repeat"]) {
el.style.setProperty(prop, eroded ? "no-repeat" : "");
}
// A zap's arcs read on a tile this small as the name crackling blue,
// its glow re-dealt at the arcs' own rate.
if (st.zap) {
const flick = 0.6 + 0.4 * ((zapSeed((now - start) / 1000) * 7919) % 5) / 4;
el.style.textShadow = `0 0 ${(3 * st.zap * flick).toFixed(1)}px #dbe6ff, 0 0 ${(9 * st.zap * flick).toFixed(1)}px #4f7bff`;
} else {
el.style.textShadow = "";
}
el.style.filter = st.brightness !== undefined ? `brightness(${st.brightness})` : "";
if (st.textProgress !== undefined) {
const word = el.dataset.word ?? "";
el.textContent = word.slice(0, Math.ceil(st.textProgress * word.length));
}
// A count demo shows its number where the count stands, and the whole
// number once the ramp is over.
if (counts) {
const word = el.dataset.word ?? "";
const shown = st.countProgress !== undefined ? countText(word, st.countProgress) : word;
if (el.textContent !== shown) {
el.textContent = shown;
}
}
raf = requestAnimationFrame(tick);
};
raf = requestAnimationFrame(tick);
// Back to rest on the way out, so a card never freezes mid-animation.
return () => {
cancelAnimationFrame(raf);
rest();
};
}, [slot, style, isText, seconds, speed, phase, label, rolls, dives, counts]);
return (
<span
ref={ref}
data-word={typed ? label : counts ? `${label} ${COUNT_DEMO_TO}` : undefined}
className={`${WORD} text-foreground`}
style={{ willChange: "transform", ...wordStyle() }}
>
{typed || counts
? null
: rolls
? [...label].map((ch, i) => (
<span key={i} className="relative inline-block align-top" style={{ overflowY: "clip" }}>
<span className="invisible">{ch}</span>
<span data-reel className="absolute top-0 left-1/2" />
<span data-reel className="absolute top-0 left-1/2" />
<span data-reel className="absolute top-0 left-1/2" />
</span>
))
: (isText && splitsGlyphs(slot, style)) || dives
? [...label].map((ch, i) => (
<span key={i} className="inline-block">
{ch}
</span>
))
: label}
</span>
);
}
/** One turn of a word-effect demo, and the beat after it: long enough to read
* an emphasis travelling off the line again and a build finishing and holding
* what it assembled. */
const WORD_DEMO_SECONDS = 1.5;
const WORD_DEMO_HOLD = 0.7;
/** The accent reads on a light panel the way it reads over footage: with the
* same shadow the caption previews give a bright caption color. */
const WORD_DEMO_SHADOW = "0 0 2px rgba(0, 0, 0, 0.6)";
/** A word-effect name, played by the engine on the name's own words — the
* same `wordDrawsAt` the preview and the burn-in read, so a tile can't promise
* a treatment the export won't draw. */
function WordName({
style,
textColor,
accentColor,
scale,
dim,
index = 0,
}: {
style: string;
/** The element's own text color — where an effect that speaks in color
* starts from, and what one that speaks in size keeps. */
textColor: string;
/** The accent it was given, if any. */
accentColor?: string;
/** The element's own swell, so a tile shows the size it will apply. */
scale?: number;
/** Its faded level, so a tile shows the transparency it will apply. */
dim?: number;
index?: number;
}) {
const ref = useRef<HTMLSpanElement>(null);
const labelOf = useSlotLabel();
const label = labelOf("words", style);
const cycle = WORD_DEMO_SECONDS + WORD_DEMO_HOLD;
const phase = index * PHASE_STEP * cycle;
useEffect(() => {
const el = ref.current;
if (!el) return;
const words: OverlayWords = {
style,
...(accentColor ? { color: accentColor } : {}),
...(scale !== undefined ? { scale } : {}),
...(dim !== undefined ? { dim } : {}),
};
const spans = Array.from(el.querySelectorAll<HTMLElement>("[data-word]"));
const rest = () => spans.forEach((sp) => (sp.style.cssText = "display:inline-block"));
const paint = (t: number) => {
const draws = wordDrawsAt(label, words, textColor, WORD_DEMO_SECONDS, t);
spans.forEach((sp, i) => {
const d = draws[i];
if (!d) return;
const css = wordDrawCss(d, 1) as Record<string, string | number>;
// A word still in the element's own color keeps the panel's foreground
// instead, which is what makes the name readable on a light card; one
// that has taken the accent wears it, with the shadow that carries a
// bright accent over any background.
const colored = d.color.toLowerCase() !== textColor.toLowerCase();
if (!colored) delete css.color;
sp.style.cssText = "display:inline-block";
Object.assign(sp.style, css);
if (colored && d.mark !== "box") sp.style.textShadow = WORD_DEMO_SHADOW;
});
};
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
paint(WORD_DEMO_SECONDS);
return rest;
}
let start = 0;
let raf = 0;
const tick = (now: number) => {
if (!start) start = now;
const local = (((now - start) / 1000 + phase) % cycle + cycle) % cycle;
paint(Math.min(local, WORD_DEMO_SECONDS));
raf = requestAnimationFrame(tick);
};
raf = requestAnimationFrame(tick);
return () => {
cancelAnimationFrame(raf);
rest();
};
}, [style, label, textColor, accentColor, scale, dim, cycle, phase]);
return (
<span ref={ref} className={`${WORD} text-foreground`} style={wordStyle()}>
{label.split(" ").map((w, i) => (
<span key={i}>
{i > 0 && " "}
<span data-word style={{ display: "inline-block" }}>
{w}
</span>
</span>
))}
</span>
);
}
/** The name in its tile: the motion itself while the tile is playing, the
* plain name when it is not. */
function AnimName({
playing,
textColor,
accentColor,
accentScale,
accentDim,
...rest
}: {
slot: Slot;
style: string;
isText: boolean;
seconds: number;
speed: number;
playing: boolean;
index?: number;
/** The element's own text color, for the words tiles. */
textColor?: string;
/** The accent it was given, if any. */
accentColor?: string;
/** Its swell, so the tiles show the size the pick will apply. */
accentScale?: number;
/** Its faded level, so the tiles show the transparency the pick will apply. */
accentDim?: number;
}) {
if (!playing) return <FrozenName slot={rest.slot} style={rest.style} />;
if (rest.slot === "words")
return (
<WordName
style={rest.style}
textColor={textColor ?? WORD_ACCENT_DEFAULT}
accentColor={accentColor}
scale={accentScale}
dim={accentDim}
index={rest.index}
/>
);
return <LiveName {...rest} />;
}
/** Whether the element is on screen. A tile off the scroll's edge keeps its
* name still and books no frames until it comes into view. */
function useOnScreen(ref: React.RefObject<HTMLElement | null>) {
const [shown, setShown] = useState(false);
useEffect(() => {
const el = ref.current;
if (!el) return;
const io = new IntersectionObserver(([e]) => setShown(e.isIntersecting), {
rootMargin: "64px",
});
io.observe(el);
return () => io.disconnect();
}, [ref]);
return shown;
}
function AnimTile({
slot,
style,
isText,
seconds,
speed,
index,
selected,
textColor,
accentColor,
accentScale,
accentDim,
onPick,
}: {
slot: Slot;
style: string;
isText: boolean;
seconds: number;
speed: number;
/** Place in the grid, which sets this tile's beat in the cascade. */
index: number;
selected: boolean;
/** The element's own text color, for the words tiles. */
textColor?: string;
/** The accent it was given, if any. */
accentColor?: string;
/** Its swell, so a words tile shows the size the pick will apply. */
accentScale?: number;
/** Its faded level, so a words tile shows the transparency it will apply. */
accentDim?: number;
onPick: () => void;
}) {
const ref = useRef<HTMLButtonElement>(null);
const onScreen = useOnScreen(ref);
const labelOf = useSlotLabel();
return (
<Tile
ref={ref}
selected={selected}
onClick={onPick}
title={labelOf(slot, style)}
className="p-1"
>
<span className={STAGE}>
<AnimName
slot={slot}
style={style}
isText={isText}
seconds={seconds}
speed={speed}
index={index}
textColor={textColor}
accentColor={accentColor}
accentScale={accentScale}
accentDim={accentDim}
playing={onScreen}
/>
</span>
</Tile>
);
}
export function AnimationTiles({
slot,
value,
custom,
isText,
seconds,
speed,
textColor,
accentColor,
accentScale,
accentDim,
onPick,
}: {
slot: Slot;
/** The style in use, or undefined for none. */
value?: string;
/** The slot plays an animation the project carries itself, so none of these
* tiles is what is running — including None. */
custom?: boolean;
/** Typing and rolling reels are offered on titles only. */
isText: boolean;
/** The In/Out length the panel has set — the hover demo's ramp. */
seconds: number;
/** The loop speed the panel has set — the hover demo's cycle rate. */
speed: number;
/** The element's own text color, so the words tiles demo the color each
* treatment will actually wear. */
textColor?: string;
/** The accent it was given, if any. */
accentColor?: string;
/** Its swell, so the tiles show the size a pick will apply. */
accentScale?: number;
/** Its faded level, so the tiles show the transparency a pick will apply. */
accentDim?: number;
onPick: (style: string | null) => void;
}) {
const t = useTranslations("inspector.animationTiles");
const tile = (id: string, i: number) => (
<AnimTile
key={id}
slot={slot}
style={id}
isText={isText}
seconds={seconds}
speed={speed}
index={i}
textColor={textColor}
accentColor={accentColor}
accentScale={accentScale}
accentDim={accentDim}
selected={value === id}
onPick={() => onPick(id)}
/>
);
const none = (
<Tile selected={!value && !custom} onClick={() => onPick(null)} title={t("none")} className="p-1">
<span className={STAGE}>
<span className={`${WORD} text-muted-foreground/70`} style={wordStyle()}>
{t("none")}
</span>
</span>
</Tile>
);
// The words grid runs long enough that one flat list stops reading as a
// choice: the effects fall into two kinds — a treatment that travels along
// the line, and a line that assembles itself — so each gets its own shelf.
if (slot === "words") {
let n = 0;
return (
<div className="flex flex-col gap-2">
<div className="grid grid-cols-2 gap-[9px]">{none}</div>
{WORD_FAMILIES.map((f) => (
<div key={f.id} className="flex flex-col gap-1.5">
<SectionTitle>{t(`wordFamilies.${f.id}`)}</SectionTitle>
<div className="grid grid-cols-2 gap-[9px]">
{wordEffectIdsIn(f.id).map((id) => tile(id, n++))}
</div>
</div>
))}
</div>
);
}
const ids: string[] =
slot === "hit"
? OVERLAY_HIT_STYLE_IDS
: slot === "move"
? HOLD_IDS
: slot === "loop"
? OVERLAY_LOOP_STYLE_IDS
: OVERLAY_ANIM_STYLE_IDS.filter((s) => isText || !TEXT_ONLY_ANIM_STYLE_IDS.includes(s));
return (
<div className="grid grid-cols-2 gap-[9px]">
{none}
{ids.map(tile)}
</div>
);
}