fix(lyrics): lift timed words together

This commit is contained in:
zarzet committed 2026-09-30 22:09:41 +07:00
1 parent fe88048db2
commit 1d3f7a0d44
4 files changed
+32 -74

No files matched your search

+3 -8
View File
@@ -89,7 +89,6 @@ double syncedLyricSegmentLift({
required Duration position,
required Duration start,
required Duration end,
double progressOffset = 0,
}) {
if (end <= start) return 0;
final elapsed = (position - start).inMicroseconds / 1000;
@@ -102,15 +101,11 @@ double syncedLyricSegmentLift({
// Start gently before the color sweep and let the movement trail it. Keep
// this envelope independent of word length: fast syllables must not snap
// upwards just because their highlight finishes in a few frames.
// Each grapheme begins as the sweep approaches its own position. Retain the
// full word's held-note envelope rather than treating letters as syllables.
final offset = duration * progressOffset.clamp(0.0, 1.0);
final normalLift = ease((elapsed - offset + 180) / 720);
// The whole timed word shares this movement, independent of the color sweep.
final normalLift = ease((elapsed + 180) / 720);
final heldStrength = ((duration - 1000) / 1500).clamp(0.0, 1.0);
if (heldStrength == 0) return normalLift;
final rise = ease((elapsed - 400) / math.min(1200, (duration - 400) * 0.6));
final settle = ease((duration - elapsed) / 600);
final wordLift = ease((elapsed + 180) / 720);
final emphasis = wordLift > 0 ? normalLift / wordLift : 0;
return normalLift + 1.3 * heldStrength * rise * settle * emphasis;
return normalLift + 1.3 * heldStrength * rise * settle;
}