Fixed karaoke rendering engine.

This commit is contained in:
translator committed 2026-03-06 16:56:04 +09:00
1 parent 3e0472d998
commit 5885229c82
4 files changed
+195 -92

No files matched your search

+1
View File
@@ -38,6 +38,7 @@ imports/
db/
./db/
projects/
claude/
# Model caches (large files, downloaded at runtime)
# These are typically mounted as volumes
+37 -2
View File
@@ -299,7 +299,7 @@ Result: shadow (back) → stroke → base text (front), all properly layered.
**hexToRgba** moved above `KaraokeWord` so `behindLayer` can call it.
Container keeps `WebkitTextStroke` + `paintOrder` + `textShadow` for non-karaoke modes (scroll/fade) where text has opaque fills and the single-element approach works correctly.
**Superseded** — stroke/shadow are now handled per-line via the behind-layer pattern for all modes. See "Universal behind-layer stroke/shadow" below.
### Layer z-index fix + sluggishness fix
@@ -324,7 +324,7 @@ The windowed overlay (`div` wrapping artist + title `<p>` tags) and the fullscre
### Stroke rounded joins — prevent "fang" artefacts
`-webkit-text-stroke` defaults to miter joins at sharp glyph corners, producing spike/fang artefacts. Fixed by adding `strokeLinejoin: 'round'` and `strokeLinecap: 'round'` (SVG stroke properties, honoured by Chromium/WebKit on HTML text with `-webkit-text-stroke`) to both the `KaraokeWord` behind-layer span and the outer lyrics container (for non-karaoke/scroll/fade modes).
`-webkit-text-stroke` defaults to miter joins at sharp glyph corners, producing spike/fang artefacts. Fixed by adding `strokeLinejoin: 'round'` and `strokeLinecap: 'round'` (SVG stroke properties, honoured by Chromium/WebKit on HTML text with `-webkit-text-stroke`) to behind-layer spans. **Superseded** by universal behind-layer approach — see below.
### Pop mode — Snap slider (transition duration)
@@ -365,3 +365,38 @@ Added `glowSize: number` to `StyleState` and `DEFAULT_STYLE` (default: 8px). A *
- `dist ≥ 3`: `scale(0.78)`, opacity fades to 0 past dist 5
`transformOrigin` is set to match `textAlign` (`left center` / `center center` / `right center`). All lines get `transition: 'transform 0.35s ease-out, opacity 0.35s ease-out'` matching the scroll transition duration so both animate in sync. Since `transform` doesn't affect layout, `offsetTop` is stable and the scroll calculation remains correct. `KaraokeWord` now receives base `fontSize` (the wrapper div's scale handles visual enlargement).
---
### Universal behind-layer stroke/shadow for all line types
**Problem:** Stroke and shadow were applied via `WebkitTextStroke` / `textShadow` on the outer lyrics container div, inherited by all descendant text. This caused:
- **Fangs** on non-active karaoke/glow/blur lines: plain `<span>` elements inherited `paintOrder: stroke fill` from the container, producing miter-join spikes at sharp letter corners.
- **Stroke inside gradient fill**: for wordless active lines using `WebkitTextFillColor: transparent`, the inherited stroke bled through the transparent fill area.
Previously only `KaraokeWord` (active words) used the behind-layer pattern. Non-active lines and wordless active lines inherited stroke/shadow from the container.
**Fix:** `WebkitTextStroke`, `paintOrder`, `strokeLinejoin`, `strokeLinecap`, and `textShadow` are **removed from the container entirely**. Every line in every mode now renders stroke and shadow via its own behind-layer:
```
Outer div — opacity, transform/scale, font size (NO stroke/shadow/padding)
behindLayer div — position: absolute, zIndex: 0, aria-hidden
strokeColor fill, WebkitTextStroke, paintOrder: stroke fill
strokeLinejoin: round, textShadow
frontLayer div — position: relative, zIndex: 1, padding
WebkitTextStroke: '0 transparent', textShadow: none
actual text color / gradient fill
```
Three shared constants computed once per render:
```typescript
const lineStrokeVal = strokeEnabled && strokeWidth > 0 ? `${strokeWidth}px ${strokeColor}` : undefined
const lineShadowVal = shadowEnabled ? `${shadowX}px ${shadowY}px ${shadowBlur}px ${hexToRgba(...)}` : undefined
const lineNeedsLayer = !!(lineStrokeVal || lineShadowVal)
```
When `lineNeedsLayer` is false the behindLayer is skipped entirely (single-div fast path).
**Coverage:** `renderScrollStyle`, `renderFadeStyle`, `renderKaraokeStyle` (non-active + active wordless), `renderGlowStyle` (non-active + active wordless), `renderBlurStyle` (non-active + active wordless). Active word-by-word lines continue to use `KaraokeWord`'s existing behind-layer.
**Result:** Fill is always the top layer; stroke appears only outside the letterform; shadow is always behind both stroke and fill — in every mode, for every line.
+1 -1
View File
@@ -19,7 +19,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="StemEngine" />
<link rel="apple-touch-icon" href="/icon.svg" />
<script type="module" crossorigin src="/assets/index-CT4p0YjA.js"></script>
<script type="module" crossorigin src="/assets/index-B-OLaG79.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-02k6pNvN.css">
</head>
<body>
+156 -89
View File
@@ -1397,33 +1397,50 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
})
}
// ── Line-level stroke / shadow layer values ───────────────────────────────
// Used by every render function to implement the behind-layer pattern:
// behindLayer (zIndex 0): stroke + shadow, painted first
// frontLayer (zIndex 1): fill only, no stroke, no shadow — always on top
// This guarantees stroke is ONLY outside the letterform and shadow is BEHIND.
const lineStrokeVal = strokeEnabled && strokeWidth > 0 ? `${strokeWidth}px ${strokeColor}` : undefined
const lineShadowVal = shadowEnabled ? `${shadowX}px ${shadowY}px ${shadowBlur}px ${hexToRgba(shadowColor, shadowOpacity)}` : undefined
const lineNeedsLayer = !!(lineStrokeVal || lineShadowVal)
// ── Line renderers ────────────────────────────────────────────────────────
function renderScrollStyle() {
if (lines.length === 0) return <p style={{ color: textColor, opacity: 0.4, textAlign }}>No lyrics</p>
const pad = '0.3em 0.75em'
return (
<>
{lines.map((line, i) => {
const isActive = i === activeLine
const isPast = i < activeLine
const isActive = i === activeLine
const isPast = i < activeLine
const lineColor = line.speaker ? getSpeakerColor(line.speaker) : (isActive ? highlightColor : textColor)
const lineFSize = isActive ? fontSize * 1.08 : fontSize * 0.9
return (
<div
key={i}
ref={isActive ? (el) => { activeLineRef.current = el } : undefined}
style={{
color: lineColor,
opacity: isActive ? 1 : isPast ? 0.45 : 0.35,
fontSize: isActive ? fontSize * 1.08 : fontSize * 0.9,
fontSize: lineFSize,
fontWeight: isActive ? 700 : 400,
textAlign,
padding: '0.3em 0.75em',
lineHeight: lineSpacing,
transition: 'all 0.25s ease',
position: lineNeedsLayer ? 'relative' : undefined,
}}
>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
{line.text}
{lineNeedsLayer && (
<div aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0, padding: pad, color: lineStrokeVal ? strokeColor : 'transparent', WebkitTextFillColor: lineStrokeVal ? strokeColor : 'transparent', WebkitTextStroke: lineStrokeVal, paintOrder: lineStrokeVal ? 'stroke fill' : undefined, strokeLinejoin: lineStrokeVal ? 'round' : undefined, textShadow: lineShadowVal, pointerEvents: 'none', userSelect: 'none', zIndex: 0 } as any}>
{line.text}
</div>
)}
<div style={{ padding: pad, color: lineColor, position: lineNeedsLayer ? 'relative' : undefined, zIndex: lineNeedsLayer ? 1 : undefined, WebkitTextStroke: lineNeedsLayer ? '0 transparent' : undefined, textShadow: lineNeedsLayer ? 'none' : undefined } as any}>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
{line.text}
</div>
</div>
)
})}
@@ -1433,6 +1450,7 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
function renderFadeStyle() {
if (lines.length === 0) return <p style={{ color: textColor, opacity: 0.4, textAlign }}>No lyrics</p>
const pad = '0.4em 0.75em'
return (
<>
{lines.map((line, i) => {
@@ -1449,18 +1467,24 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
key={i}
ref={active ? (el) => { activeLineRef.current = el } : undefined}
style={{
color: lineColor,
opacity,
fontSize: active ? fontSize * 1.12 : fontSize,
fontWeight: active ? 700 : 400,
textAlign,
padding: '0.4em 0.75em',
lineHeight: lineSpacing,
transition: 'all 0.35s ease',
position: lineNeedsLayer ? 'relative' : undefined,
}}
>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
{line.text}
{lineNeedsLayer && (
<div aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0, padding: pad, color: lineStrokeVal ? strokeColor : 'transparent', WebkitTextFillColor: lineStrokeVal ? strokeColor : 'transparent', WebkitTextStroke: lineStrokeVal, paintOrder: lineStrokeVal ? 'stroke fill' : undefined, strokeLinejoin: lineStrokeVal ? 'round' : undefined, textShadow: lineShadowVal, pointerEvents: 'none', userSelect: 'none', zIndex: 0 } as any}>
{line.text}
</div>
)}
<div style={{ padding: pad, color: lineColor, position: lineNeedsLayer ? 'relative' : undefined, zIndex: lineNeedsLayer ? 1 : undefined, WebkitTextStroke: lineNeedsLayer ? '0 transparent' : undefined, textShadow: lineNeedsLayer ? 'none' : undefined } as any}>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
{line.text}
</div>
</div>
)
})}
@@ -1483,34 +1507,37 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
const scale = active ? 1.0 : dist === 1 ? 0.88 : dist === 2 ? 0.82 : 0.78
if (!active) {
const pad = '0.4em 0.75em'
const wColor = line.speaker ? getSpeakerColor(line.speaker) : (past ? wordHighlight : textColor)
const behindContent = line.words.length > 0
? line.words.map((w, wi) => <span key={wi} style={{ marginRight: w.isWordEnd ? '0.25em' : '0' }}>{w.text}</span>)
: line.text
const frontContent = line.words.length > 0
? line.words.map((w, wi) => <span key={wi} style={{ color: wColor, marginRight: w.isWordEnd ? '0.25em' : '0' }}>{w.text}</span>)
: <span style={{ color: wColor }}>{line.text}</span>
return (
<div
key={i}
style={{
textAlign,
padding: '0.4em 0.75em',
fontSize,
lineHeight: lineSpacing,
opacity: dist > 5 ? 0 : (past ? 0.55 : 0.25),
transform: `scale(${scale})`,
transformOrigin: lineOrigin,
transition: 'transform 0.35s ease-out, opacity 0.35s ease-out',
position: lineNeedsLayer ? 'relative' : undefined,
}}
>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
{line.words.length > 0
? line.words.map((w, wi) => {
const wColor = line.speaker
? getSpeakerColor(line.speaker)
: (past ? wordHighlight : textColor)
return (
<span key={wi} style={{ color: wColor, marginRight: w.isWordEnd ? '0.25em' : '0' }}>
{w.text}
</span>
)
})
: <span style={{ color: line.speaker ? getSpeakerColor(line.speaker) : (past ? wordHighlight : textColor) }}>{line.text}</span>
}
{lineNeedsLayer && (
<div aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0, padding: pad, color: lineStrokeVal ? strokeColor : 'transparent', WebkitTextFillColor: lineStrokeVal ? strokeColor : 'transparent', WebkitTextStroke: lineStrokeVal, paintOrder: lineStrokeVal ? 'stroke fill' : undefined, strokeLinejoin: lineStrokeVal ? 'round' : undefined, textShadow: lineShadowVal, pointerEvents: 'none', userSelect: 'none', zIndex: 0 } as any}>
{behindContent}
</div>
)}
<div style={{ padding: pad, position: lineNeedsLayer ? 'relative' : undefined, zIndex: lineNeedsLayer ? 1 : undefined, WebkitTextStroke: lineNeedsLayer ? '0 transparent' : undefined, textShadow: lineNeedsLayer ? 'none' : undefined } as any}>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
{frontContent}
</div>
</div>
)
}
@@ -1559,22 +1586,32 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
)
})
: (() => {
const nextTime = lines[activeLine + 1]?.time ?? (line.time + 4)
const pct = Math.max(0, Math.min(1, (currentTime - line.time) / (nextTime - line.time)))
const nextTime = lines[activeLine + 1]?.time ?? (line.time + 4)
const pct = Math.max(0, Math.min(1, (currentTime - line.time) / (nextTime - line.time)))
const fillColor = line.speaker ? getSpeakerColor(line.speaker) : highlightColor
return (
<span
style={{
display: 'inline-block',
verticalAlign: 'top',
backgroundImage: `linear-gradient(to right, ${fillColor} ${Math.round(pct * 100)}%, ${fillColor}50 ${Math.round(pct * 100)}%)`,
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text',
} as React.CSSProperties}
>
{line.text}
</span>
<>
{lineNeedsLayer && (
<span aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0, color: lineStrokeVal ? strokeColor : 'transparent', WebkitTextFillColor: lineStrokeVal ? strokeColor : 'transparent', WebkitTextStroke: lineStrokeVal, paintOrder: lineStrokeVal ? 'stroke fill' : undefined, strokeLinejoin: lineStrokeVal ? 'round' : undefined, textShadow: lineShadowVal, pointerEvents: 'none', userSelect: 'none', zIndex: 0 } as any}>
{line.text}
</span>
)}
<span
style={{
display: 'inline-block',
verticalAlign: 'top',
backgroundImage: `linear-gradient(to right, ${fillColor} ${Math.round(pct * 100)}%, ${fillColor}50 ${Math.round(pct * 100)}%)`,
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text',
position: lineNeedsLayer ? 'relative' : undefined,
zIndex: lineNeedsLayer ? 1 : undefined,
textShadow: lineNeedsLayer ? 'none' : undefined,
} as any}
>
{line.text}
</span>
</>
)
})()
}
@@ -1600,29 +1637,37 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
const scale = active ? 1.0 : dist === 1 ? 0.88 : dist === 2 ? 0.82 : 0.78
if (!active) {
const pad = '0.4em 0.75em'
const wColor = past ? (line.speaker ? getSpeakerColor(line.speaker) : wordHighlight) : textColor
const behindContent = line.words.length > 0
? line.words.map((w, wi) => <span key={wi} style={{ marginRight: w.isWordEnd ? '0.25em' : '0' }}>{w.text}</span>)
: line.text
const frontContent = line.words.length > 0
? line.words.map((w, wi) => <span key={wi} style={{ color: wColor, marginRight: w.isWordEnd ? '0.25em' : '0' }}>{w.text}</span>)
: <span style={{ color: wColor }}>{line.text}</span>
return (
<div
key={i}
style={{
textAlign,
padding: '0.4em 0.75em',
fontSize,
lineHeight: lineSpacing,
opacity: dist > 5 ? 0 : (past ? 0.5 : 0.2),
transform: `scale(${scale})`,
transformOrigin: lineOrigin,
transition: 'transform 0.35s ease-out, opacity 0.35s ease-out',
position: lineNeedsLayer ? 'relative' : undefined,
}}
>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
{line.words.length > 0
? line.words.map((w, wi) => (
<span key={wi} style={{ color: past ? (line.speaker ? getSpeakerColor(line.speaker) : wordHighlight) : textColor, marginRight: w.isWordEnd ? '0.25em' : '0' }}>
{w.text}
</span>
))
: <span style={{ color: past ? (line.speaker ? getSpeakerColor(line.speaker) : wordHighlight) : textColor }}>{line.text}</span>
}
{lineNeedsLayer && (
<div aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0, padding: pad, color: lineStrokeVal ? strokeColor : 'transparent', WebkitTextFillColor: lineStrokeVal ? strokeColor : 'transparent', WebkitTextStroke: lineStrokeVal, paintOrder: lineStrokeVal ? 'stroke fill' : undefined, strokeLinejoin: lineStrokeVal ? 'round' : undefined, textShadow: lineShadowVal, pointerEvents: 'none', userSelect: 'none', zIndex: 0 } as any}>
{behindContent}
</div>
)}
<div style={{ padding: pad, position: lineNeedsLayer ? 'relative' : undefined, zIndex: lineNeedsLayer ? 1 : undefined, WebkitTextStroke: lineNeedsLayer ? '0 transparent' : undefined, textShadow: lineNeedsLayer ? 'none' : undefined } as any}>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
{frontContent}
</div>
</div>
)
}
@@ -1678,19 +1723,29 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
const nextT = lines[activeLine + 1]?.time ?? (line.time + 4)
const pct = Math.max(0, Math.min(1, (currentTime - line.time) / (nextT - line.time)))
return (
<span
ref={activeWordSpanRef}
style={{
display: 'inline-block',
verticalAlign: 'top',
backgroundImage: `linear-gradient(to right, ${glowColor} ${Math.round(pct * 100)}%, ${dimColor} ${Math.round(pct * 100)}%)`,
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text',
} as React.CSSProperties}
>
{line.text}
</span>
<>
{lineNeedsLayer && (
<span aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0, color: lineStrokeVal ? strokeColor : 'transparent', WebkitTextFillColor: lineStrokeVal ? strokeColor : 'transparent', WebkitTextStroke: lineStrokeVal, paintOrder: lineStrokeVal ? 'stroke fill' : undefined, strokeLinejoin: lineStrokeVal ? 'round' : undefined, textShadow: lineShadowVal, pointerEvents: 'none', userSelect: 'none', zIndex: 0 } as any}>
{line.text}
</span>
)}
<span
ref={activeWordSpanRef}
style={{
display: 'inline-block',
verticalAlign: 'top',
backgroundImage: `linear-gradient(to right, ${glowColor} ${Math.round(pct * 100)}%, ${dimColor} ${Math.round(pct * 100)}%)`,
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text',
position: lineNeedsLayer ? 'relative' : undefined,
zIndex: lineNeedsLayer ? 1 : undefined,
textShadow: lineNeedsLayer ? 'none' : undefined,
} as any}
>
{line.text}
</span>
</>
)
})()
}
@@ -1716,24 +1771,33 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
const scale = active ? 1.0 : dist === 1 ? 0.88 : dist === 2 ? 0.82 : 0.78
if (!active) {
const pad = '0.4em 0.75em'
const wColor = past ? (line.speaker ? getSpeakerColor(line.speaker) : wordHighlight) : textColor
const lineText = line.words.length > 0 ? line.words.map(w => w.text + (w.isWordEnd ? ' ' : '')).join('') : line.text
return (
<div
key={i}
style={{
textAlign,
padding: '0.4em 0.75em',
fontSize,
lineHeight: lineSpacing,
color: past ? (line.speaker ? getSpeakerColor(line.speaker) : wordHighlight) : textColor,
opacity: dist > 5 ? 0 : (past ? 0.4 : 0.15),
filter: dist > 4 ? 'none' : `blur(${dist * 1.5}px)`,
transform: `scale(${scale})`,
transformOrigin: lineOrigin,
transition: 'transform 0.35s ease-out, opacity 0.35s ease-out, filter 0.35s ease-out',
position: lineNeedsLayer ? 'relative' : undefined,
}}
>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
<span>{line.words.length > 0 ? line.words.map(w => w.text + (w.isWordEnd ? ' ' : '')).join('') : line.text}</span>
{lineNeedsLayer && (
<div aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0, padding: pad, color: lineStrokeVal ? strokeColor : 'transparent', WebkitTextFillColor: lineStrokeVal ? strokeColor : 'transparent', WebkitTextStroke: lineStrokeVal, paintOrder: lineStrokeVal ? 'stroke fill' : undefined, strokeLinejoin: lineStrokeVal ? 'round' : undefined, textShadow: lineShadowVal, pointerEvents: 'none', userSelect: 'none', zIndex: 0 } as any}>
{lineText}
</div>
)}
<div style={{ padding: pad, color: wColor, position: lineNeedsLayer ? 'relative' : undefined, zIndex: lineNeedsLayer ? 1 : undefined, WebkitTextStroke: lineNeedsLayer ? '0 transparent' : undefined, textShadow: lineNeedsLayer ? 'none' : undefined } as any}>
<SpeakerDot line={line} prevSpeaker={lines[i - 1]?.speaker} color={line.speaker ? getSpeakerColor(line.speaker) : undefined} name={line.speaker ? getSpeakerName(line.speaker) : undefined} />
<span>{lineText}</span>
</div>
</div>
)
}
@@ -1788,19 +1852,29 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
const pct = Math.max(0, Math.min(1, (currentTime - line.time) / (nextT - line.time)))
const fillColor = line.speaker ? getSpeakerColor(line.speaker) : highlightColor
return (
<span
ref={activeWordSpanRef}
style={{
display: 'inline-block',
verticalAlign: 'top',
backgroundImage: `linear-gradient(to right, ${fillColor} ${Math.round(pct * 100)}%, ${fillColor}50 ${Math.round(pct * 100)}%)`,
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text',
} as React.CSSProperties}
>
{line.text}
</span>
<>
{lineNeedsLayer && (
<span aria-hidden="true" style={{ position: 'absolute', top: 0, left: 0, right: 0, color: lineStrokeVal ? strokeColor : 'transparent', WebkitTextFillColor: lineStrokeVal ? strokeColor : 'transparent', WebkitTextStroke: lineStrokeVal, paintOrder: lineStrokeVal ? 'stroke fill' : undefined, strokeLinejoin: lineStrokeVal ? 'round' : undefined, textShadow: lineShadowVal, pointerEvents: 'none', userSelect: 'none', zIndex: 0 } as any}>
{line.text}
</span>
)}
<span
ref={activeWordSpanRef}
style={{
display: 'inline-block',
verticalAlign: 'top',
backgroundImage: `linear-gradient(to right, ${fillColor} ${Math.round(pct * 100)}%, ${fillColor}50 ${Math.round(pct * 100)}%)`,
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
backgroundClip: 'text',
position: lineNeedsLayer ? 'relative' : undefined,
zIndex: lineNeedsLayer ? 1 : undefined,
textShadow: lineNeedsLayer ? 'none' : undefined,
} as any}
>
{line.text}
</span>
</>
)
})()
}
@@ -1832,15 +1906,8 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
flex: isFullscreen ? '1 1 0' : undefined,
overflow: 'hidden',
position: 'relative',
textShadow: shadowEnabled
? `${shadowX}px ${shadowY}px ${shadowBlur}px ${hexToRgba(shadowColor, shadowOpacity)}`
: undefined,
WebkitTextStroke: (strokeEnabled && strokeWidth > 0)
? `${strokeWidth}px ${strokeColor}`
: undefined,
paintOrder: (strokeEnabled && strokeWidth > 0) ? 'stroke fill' : undefined,
strokeLinejoin: (strokeEnabled && strokeWidth > 0) ? 'round' : undefined,
strokeLinecap: (strokeEnabled && strokeWidth > 0) ? 'round' : undefined,
// Stroke and shadow are NOT set on the container — each line div renders them
// via its own behindLayer (see lineNeedsLayer / lineStrokeVal / lineShadowVal above).
} as any}
>
<div