@braccato/core 1.21.3 → 1.21.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,6 @@
1
1
  import type { AnimationEngineInstance } from "./instance.js";
2
2
  import { type LineScrollItem } from "./lineScroll.js";
3
- export interface LineCulling {
4
- scroller: HTMLElement;
5
- contentOffset: number;
6
- followReaderScroll: () => void;
7
- startObserver: IntersectionObserver | null;
8
- ready: boolean;
9
- }
10
- export declare function setupLineCulling(engine: AnimationEngineInstance): void;
11
- export declare function stopLineCulling(engine: AnimationEngineInstance): void;
12
- export declare function updateLineCulling(engine: AnimationEngineInstance, fromScrollTop: number, toScrollTop: number, viewportHeight: number): void;
13
- export declare function measureContentOffset(scroller: HTMLElement, container: HTMLElement): number;
3
+ export declare function setupLineCullObserver(engine: AnimationEngineInstance): void;
14
4
  export declare function clearOffscreenLineCulling(engine: AnimationEngineInstance): void;
15
5
  export declare function updateVisibleLyricWillChange(engine: AnimationEngineInstance, lines: LineScrollItem[], fromScrollTop: number, toScrollTop: number, viewportHeight: number): void;
16
6
  export declare function clearVisibleLyricWillChange(engine: AnimationEngineInstance): void;
@@ -1,106 +1,41 @@
1
1
  import { hasUnplacedContextSweeps } from "./contextSweep.js";
2
2
  import { resetLineAnimationState } from "./lineAnimationState.js";
3
3
  import { isLineVisibleDuringScroll, LINE_SCROLL_WILL_CHANGE_VALUE } from "./lineScroll.js";
4
- // A skipped line keeps the height it last rendered at, so none is skipped before two rendering updates
5
- // have laid every line out. An intersection observation is delivered as its own task after one has, so starting
6
- // from it never adds a resize observation to a rendering update that is already delivering them.
7
- const RENDERING_UPDATES_BEFORE_SKIPPING = 2;
8
- export function setupLineCulling(engine) {
9
- stopLineCulling(engine);
10
- const container = engine.lyricsContainer;
11
- if (engine.layout === "stage" || !container || engine.lines.length === 0)
12
- return;
13
- const scroller = engine.host.getScrollElement();
14
- if (!scroller?.isConnected)
4
+ // Use screen intersections because transformed scrolling decouples layout coordinates from visibility.
5
+ const ONE_VIEWPORT_OVERSCAN = "100% 0px 100% 0px";
6
+ export function setupLineCullObserver(engine) {
7
+ engine.lineCullObserver?.disconnect();
8
+ engine.lineCullObserver = null;
9
+ clearOffscreenLineCulling(engine);
10
+ const Observer = engine.window.IntersectionObserver;
11
+ if (engine.layout === "stage" || typeof Observer !== "function" || engine.lines.length === 0)
15
12
  return;
16
13
  // The engine owns scrollTop; Firefox's scroll anchoring would answer cull height shifts with a scroll the
17
14
  // engine reads as the user's.
18
- scroller.style.setProperty("overflow-anchor", "none");
15
+ engine.host.getScrollElement()?.style.setProperty("overflow-anchor", "none");
19
16
  pinCulledLineHeights(engine);
20
- const culling = {
21
- scroller,
22
- contentOffset: measureContentOffset(scroller, container),
23
- followReaderScroll: () => cullAroundScroller(engine, culling),
24
- startObserver: null,
25
- ready: false,
26
- };
27
- engine.lineCulling = culling;
28
- scroller.addEventListener("scroll", culling.followReaderScroll, { passive: true });
29
- startCullingAfterRenderingUpdates(engine, culling, container, RENDERING_UPDATES_BEFORE_SKIPPING);
30
- for (const line of engine.lines) {
31
- if (!engine.culledLineElements.has(line.lyricElement))
32
- restartUnplacedLine(line);
33
- }
34
- }
35
- export function stopLineCulling(engine) {
36
- const culling = engine.lineCulling;
37
- if (culling) {
38
- culling.scroller.removeEventListener("scroll", culling.followReaderScroll);
39
- culling.startObserver?.disconnect();
40
- }
41
- engine.lineCulling = null;
42
- clearOffscreenLineCulling(engine);
43
- }
44
- function cullAroundScroller(engine, culling) {
45
- if (!culling.scroller.isConnected)
46
- return;
47
- const scrollTop = culling.scroller.scrollTop;
48
- const viewportHeight = engine.cachedTabRendererHeight ?? culling.scroller.clientHeight;
49
- updateLineCulling(engine, scrollTop, engine.pendingLineScroll?.toScrollTop ?? scrollTop, viewportHeight);
50
- }
51
- // A line scroll's transforms stay between the two scroll positions; one viewport either side is the margin.
52
- export function updateLineCulling(engine, fromScrollTop, toScrollTop, viewportHeight) {
53
- const culling = engine.lineCulling;
54
- if (!culling?.ready)
55
- return;
56
- const top = Math.min(fromScrollTop, toScrollTop) - viewportHeight - culling.contentOffset;
57
- const bottom = Math.max(fromScrollTop, toScrollTop) + 2 * viewportHeight - culling.contentOffset;
58
- for (const line of engine.lines) {
59
- const element = line.lyricElement;
60
- const rendered = !isMeasured(line) || (line.position + line.height >= top && line.position <= bottom);
61
- if (rendered) {
62
- if (!engine.culledLineElements.delete(element))
63
- continue;
64
- uncullLine(element);
65
- restartUnplacedLine(line);
66
- }
67
- else if (!engine.culledLineElements.has(element)) {
68
- cullLine(element);
69
- engine.culledLineElements.add(element);
70
- }
71
- }
72
- }
73
- function startCullingAfterRenderingUpdates(engine, culling, container, updates) {
74
- const Observer = engine.window.IntersectionObserver;
75
- if (typeof Observer !== "function")
76
- return;
77
- const observer = new Observer(() => {
78
- observer.disconnect();
79
- culling.startObserver = null;
80
- if (engine.lineCulling !== culling)
81
- return;
82
- if (updates > 1) {
83
- startCullingAfterRenderingUpdates(engine, culling, container, updates - 1);
84
- return;
17
+ const observer = new Observer(entries => {
18
+ for (const entry of entries) {
19
+ const element = entry.target;
20
+ if (entry.isIntersecting) {
21
+ if (engine.culledLineElements.delete(element))
22
+ uncullLine(element);
23
+ restartUnplacedLine(engine, element);
24
+ }
25
+ else if (!engine.culledLineElements.has(element)) {
26
+ cullLine(element);
27
+ engine.culledLineElements.add(element);
28
+ }
85
29
  }
86
- culling.ready = true;
87
- cullAroundScroller(engine, culling);
88
- });
89
- culling.startObserver = observer;
90
- observer.observe(container);
91
- }
92
- function isMeasured(line) {
93
- return line.position >= 0 && line.height >= 0;
94
- }
95
- // The document's scrolling element moves with the page, so its content starts at the viewport's top edge.
96
- export function measureContentOffset(scroller, container) {
97
- const scrollsDocument = scroller === scroller.ownerDocument?.scrollingElement;
98
- const scrollerTop = scrollsDocument ? 0 : scroller.getBoundingClientRect().y + scroller.clientTop;
99
- return container.getBoundingClientRect().y - scrollerTop + scroller.scrollTop;
30
+ }, { root: null, rootMargin: ONE_VIEWPORT_OVERSCAN, threshold: 0 });
31
+ for (const line of engine.lines)
32
+ observer.observe(line.lyricElement);
33
+ engine.lineCullObserver = observer;
100
34
  }
101
35
  /** A line that started while it was skipped starts over now that its words have boxes to place on. */
102
- function restartUnplacedLine(line) {
103
- if (hasUnplacedContextSweeps(line))
36
+ function restartUnplacedLine(engine, element) {
37
+ const line = engine.lines.find(candidate => candidate.lyricElement === element);
38
+ if (line && hasUnplacedContextSweeps(line))
104
39
  resetLineAnimationState(line);
105
40
  }
106
41
  export function clearOffscreenLineCulling(engine) {
@@ -1,5 +1,5 @@
1
1
  import type { AnimationEngineInstance } from "./instance.js";
2
- import { type MotionCurve } from "./motionCurves.js";
2
+ import { type EasingLookup, type MotionCurve } from "./motionCurves.js";
3
3
  export type MotionKind = "scroll" | "slide";
4
4
  export interface ElementCurve extends MotionCurve {
5
5
  kind: MotionKind;
@@ -15,3 +15,4 @@ export declare function removeElementCurves(engine: AnimationEngineInstance, ele
15
15
  export declare function stopElementMotion(engine: AnimationEngineInstance, element: HTMLElement): void;
16
16
  export declare function stopAllElementMotion(engine: AnimationEngineInstance): void;
17
17
  export declare function elementMotionOffsetPx(engine: AnimationEngineInstance, element: HTMLElement): number;
18
+ export declare function easingLookup(engine: AnimationEngineInstance): EasingLookup;
@@ -61,7 +61,7 @@ function playCurves(engine, element, curves, nowMs) {
61
61
  animation.addEventListener("finish", settle, { once: true });
62
62
  animation.addEventListener("cancel", settle, { once: true });
63
63
  }
64
- function easingLookup(engine) {
64
+ export function easingLookup(engine) {
65
65
  return easing => {
66
66
  let table = engine.easingTables.get(easing);
67
67
  if (!table) {
@@ -6,7 +6,6 @@ import type { ElementMotion } from "./elementMotion.js";
6
6
  import type { LineScrollItem, PendingLineScroll, RunningLineScroll } from "./lineScroll.js";
7
7
  import type { LineScrollTiming } from "./lineScrollStyle.js";
8
8
  import type { AnimationSettings } from "./animationConfig.js";
9
- import { type LineCulling } from "./culling.js";
10
9
  /**
11
10
  * Everything that belongs to a single rendered lyrics view: one scroll container, one selection,
12
11
  * one set of pending scroll work.
@@ -66,7 +65,7 @@ export interface AnimationEngineInstance extends AnimEngineViewState {
66
65
  visibleWillChangeElements: Set<HTMLElement>;
67
66
  culledLineElements: Set<HTMLElement>;
68
67
  waveAnimationPool: Animation[];
69
- lineCulling: LineCulling | null;
68
+ lineCullObserver: IntersectionObserver | null;
70
69
  cachedDurations: Map<string, number>;
71
70
  cachedCSSValues: Map<string, string>;
72
71
  cachedAnimationSettings: AnimationSettings | null;
@@ -1,7 +1,6 @@
1
1
  import { NO_SCROLL_INSETS } from "./scrollViewport.js";
2
2
  import { REDUCED_MOTION_QUERY } from "./motionPreference.js";
3
3
  import { clearStyleCaches } from "./cssValues.js";
4
- import { stopLineCulling } from "./culling.js";
5
4
  import { liveEngines } from "./liveViews.js";
6
5
  import { stopPassiveScrollLoop } from "./passiveScroll.js";
7
6
  import { cancelLyricPositionUpdate } from "./tick.js";
@@ -50,7 +49,7 @@ export function createAnimationEngineInstance(engineDocument, engineWindow, host
50
49
  visibleWillChangeElements: new Set(),
51
50
  culledLineElements: new Set(),
52
51
  waveAnimationPool: [],
53
- lineCulling: null,
52
+ lineCullObserver: null,
54
53
  cachedDurations: new Map(),
55
54
  cachedCSSValues: new Map(),
56
55
  cachedAnimationSettings: null,
@@ -78,7 +77,8 @@ export function createAnimationEngineInstance(engineDocument, engineWindow, host
78
77
  engine.tabRendererResizeObserver?.disconnect();
79
78
  engine.tabRendererResizeObserver = null;
80
79
  engine.observedTabRenderer = null;
81
- stopLineCulling(engine);
80
+ engine.lineCullObserver?.disconnect();
81
+ engine.lineCullObserver = null;
82
82
  stopPassiveScrollLoop(engine);
83
83
  cancelLyricPositionUpdate(engine);
84
84
  },
@@ -1,5 +1,5 @@
1
1
  import { ANIMATING_CLASS, CURRENT_LYRICS_CLASS } from "../constants.js";
2
- import { clearVisibleLyricWillChange, stopLineCulling } from "./culling.js";
2
+ import { clearOffscreenLineCulling, clearVisibleLyricWillChange } from "./culling.js";
3
3
  import { DECORATION_MIN_SHIFT_PX, decorationSlideAllowed, slideElementBy } from "./decorationSlides.js";
4
4
  import { stopAllElementMotion, stopElementMotion } from "./elementMotion.js";
5
5
  import { resetLineAnimationState, togglePartClass } from "./lineAnimationState.js";
@@ -28,7 +28,9 @@ export function clearLyrics(engine) {
28
28
  dropPendingLineScroll(engine);
29
29
  stopAllElementMotion(engine);
30
30
  clearVisibleLyricWillChange(engine);
31
- stopLineCulling(engine);
31
+ engine.lineCullObserver?.disconnect();
32
+ engine.lineCullObserver = null;
33
+ clearOffscreenLineCulling(engine);
32
34
  for (const line of engine.lines) {
33
35
  resetLineAnimationState(line);
34
36
  line.isSelected = false;
@@ -24,6 +24,8 @@ export declare function cellFade(swipe: SwipeRamp, span: CellSpan): number;
24
24
  * the cell's halo would show behind the edge before any of its text is lit, so its glow waits.
25
25
  */
26
26
  export declare function cellReachedAt(swipe: SwipeRamp, span: CellSpan): number;
27
+ /** How far through the swipe, in eased progress, its start stop reaches the end of a cell. */
28
+ export declare function cellLitAt(swipe: SwipeRamp, span: CellSpan): number;
27
29
  /**
28
30
  * Plans one cell of a sweep. In the cell's own widths the start stop runs from
29
31
  * `(startFrom - span.start) / span.width` to `(startTo - span.start) / span.width`, and the cell only
@@ -25,8 +25,15 @@ export function cellFade(swipe, span) {
25
25
  * the cell's halo would show behind the edge before any of its text is lit, so its glow waits.
26
26
  */
27
27
  export function cellReachedAt(swipe, span) {
28
+ return startStopReaches(swipe, span.start);
29
+ }
30
+ /** How far through the swipe, in eased progress, its start stop reaches the end of a cell. */
31
+ export function cellLitAt(swipe, span) {
32
+ return startStopReaches(swipe, span.start + span.width);
33
+ }
34
+ function startStopReaches(swipe, position) {
28
35
  const stops = swipeStops(swipe);
29
- return stops ? clamp((span.start - stops.startFrom) / (stops.startTo - stops.startFrom), 0, 1) : 0;
36
+ return stops ? clamp((position - stops.startFrom) / (stops.startTo - stops.startFrom), 0, 1) : 0;
30
37
  }
31
38
  /**
32
39
  * Plans one cell of a sweep. In the cell's own widths the start stop runs from
@@ -5,7 +5,7 @@ import { applyPlaybackRateToRunningAnimations, correctedScrollTimeS } from "./an
5
5
  import { followFocusedLines, lastSungLine } from "./autoScroll.js";
6
6
  import { advancePlaybackClock, lyricClockShiftS, NO_PLAYER_SNAPSHOT, playbackClock } from "./clock.js";
7
7
  import { getCSSDurationInMs } from "./cssValues.js";
8
- import { clearOffscreenLineCulling, clearVisibleLyricWillChange, setupLineCulling, updateLineCulling, updateVisibleLyricWillChange, } from "./culling.js";
8
+ import { clearOffscreenLineCulling, clearVisibleLyricWillChange, setupLineCullObserver, updateVisibleLyricWillChange, } from "./culling.js";
9
9
  import { captureDecorationSlide, lineDecorators } from "./decorationSlides.js";
10
10
  import { resetLineAnimationState } from "./lineAnimationState.js";
11
11
  import { driveLineAnimations } from "./lineLifecycle.js";
@@ -101,15 +101,9 @@ function renderSyncedLyrics(engine, lyricsElement, playhead, options, now) {
101
101
  clearVisibleLyricWillChange(engine);
102
102
  return;
103
103
  }
104
- if (scroller) {
104
+ if (scroller && config.enabled.scroll) {
105
105
  const pendingScrollTop = engine.pendingLineScroll?.toScrollTop ?? scroller.scrollTop;
106
- updateLineCulling(engine, scroller.scrollTop, pendingScrollTop, scroller.height);
107
- if (config.enabled.scroll) {
108
- updateVisibleLyricWillChange(engine, engine.lines, scroller.scrollTop, pendingScrollTop, scroller.height);
109
- }
110
- else {
111
- stopLineScrolling(engine);
112
- }
106
+ updateVisibleLyricWillChange(engine, engine.lines, scroller.scrollTop, pendingScrollTop, scroller.height);
113
107
  }
114
108
  else {
115
109
  stopLineScrolling(engine);
@@ -216,7 +210,7 @@ export function relayout(engine, linesAreRendered) {
216
210
  const restarted = restartContextSweeps(engine);
217
211
  engine.cachedCreditsItem = measureTrailingItem(lyricsElement, CREDITS_CLASS);
218
212
  engine.cachedFooterItem = measureTrailingItem(lyricsElement, FOOTER_CLASS);
219
- setupLineCulling(engine);
213
+ setupLineCullObserver(engine);
220
214
  requestRescroll(engine);
221
215
  engine.host.debug?.resize();
222
216
  return restarted;
@@ -1,9 +1,10 @@
1
1
  import { RTL_CLASS } from "../constants.js";
2
2
  import { registerThemeSetting } from "../themeSettings.js";
3
3
  import { correctedAnimationTimeMs, mirrorHighlightAnimations, followSongClock } from "./animationTiming.js";
4
+ import { easingLookup } from "./elementMotion.js";
4
5
  import { GECKO_REDRAW, GECKO_REDRAW_KEYFRAMES, GECKO_REDRAW_PERIOD_MS, LETTER_WAVE_CREST_OFFSET, planLetterWave, swipeRamp, } from "./letterPlans.js";
5
6
  import { resetPartAnimations } from "./lineAnimationState.js";
6
- import { cellReachedAt, planCellSweep } from "./sweepPlans.js";
7
+ import { cellLitAt, cellReachedAt, planCellSweep } from "./sweepPlans.js";
7
8
  import { acquireWaveAnimation } from "./wavePool.js";
8
9
  const SWIPE_LEAD_RATIO = registerThemeSetting("blyrics-swipe-lead-ratio", 0.1);
9
10
  const SWIPE_DURATION_RATIO = registerThemeSetting("blyrics-swipe-duration-ratio", 1.6);
@@ -13,6 +14,8 @@ const INSTANT_MS = 1;
13
14
  const SHOWN = [{ opacity: 1 }, { opacity: 1 }];
14
15
  const FADE_IN = [{ opacity: 0 }, { opacity: 1 }];
15
16
  const FADE_OUT = [{ opacity: 1 }, { opacity: 0 }];
17
+ // A line's exit leaves the started ones running so a glow fades out under the text instead of cutting off.
18
+ const glowDelaysMs = new WeakMap();
16
19
  export function startWordAnimations(engine, part, config, lyricTimeS, appliedTimingOffsetMs) {
17
20
  resetPartAnimations(part);
18
21
  const word = wordTimeline(engine, part, config, lyricTimeS, appliedTimingOffsetMs);
@@ -23,6 +26,8 @@ export function startWordAnimations(engine, part, config, lyricTimeS, appliedTim
23
26
  part.animations = [...highlight, ...mirrorHighlightAnimations(part, highlight), ...motion];
24
27
  }
25
28
  export function startWordExitAnimation(part, config) {
29
+ const glows = part.animations.filter(animation => glowStarted(animation));
30
+ part.animations = part.animations.filter(animation => !glows.includes(animation));
26
31
  resetPartAnimations(part);
27
32
  const fades = config.enabled.highlightFade;
28
33
  const durationMs = fades ? config.highlight.fadeOutDurationMs : INSTANT_MS;
@@ -31,9 +36,13 @@ export function startWordExitAnimation(part, config) {
31
36
  easing: fades ? config.highlight.fadeOutEasing : "linear",
32
37
  fill: "none",
33
38
  });
34
- part.animations = [fadeOut, ...mirrorHighlightAnimations(part, [fadeOut])];
39
+ part.animations = [fadeOut, ...mirrorHighlightAnimations(part, [fadeOut]), ...glows];
35
40
  fadeOut.addEventListener("finish", () => resetPartAnimations(part), { once: true });
36
41
  }
42
+ function glowStarted(animation) {
43
+ const delayMs = glowDelaysMs.get(animation);
44
+ return delayMs !== undefined && Number(animation.currentTime) >= delayMs;
45
+ }
37
46
  function wordTimeline(engine, part, config, lyricTimeS, appliedTimingOffsetMs) {
38
47
  const durationMs = Math.max(0, part.duration * 1000);
39
48
  return {
@@ -123,27 +132,27 @@ function glow(word, durationMs, followsSwipe) {
123
132
  }
124
133
  // Where the shrinking radius reaches the tight halo's, as a fraction of the glow's eased progress.
125
134
  const TIGHT_GLOW_AT = 0.6;
135
+ // The latest a halo may finish rising, so the crossfade after it keeps room to run.
136
+ const LATEST_GLOW_PEAK = TIGHT_GLOW_AT / 2;
126
137
  /**
127
138
  * Stands in for a glow whose radius shrinks to nothing: the wide halo crossfades into the tight one
128
139
  * while the radius would shrink between them, and the tight one then fades out. The keyframe offsets
129
140
  * are in eased progress, since the glow's easing applies to the whole effect. Under a swipe each
130
- * cell's glow starts when the edge reaches it, so a halo never shows ahead of its lit text. The wait
131
- * is exact for a linear swipe and taken as linear for any other.
141
+ * cell's glow starts when the edge reaches it and rises while the edge crosses it, the way a glow
142
+ * drawn from the lit text grows with it. Both are exact for a linear swipe and taken as linear for
143
+ * any other.
132
144
  */
133
145
  function sweepGlow(word, cells, durationMs, followsSwipe) {
134
- const { config, swipeLeadMs, swipeDurationMs } = word;
146
+ const { engine, config, swipeLeadMs, swipeDurationMs } = word;
135
147
  const fades = config.highlight.glowRestingInvisible;
136
- const wide = fades
137
- ? [{ opacity: 1 }, { opacity: 0, offset: TIGHT_GLOW_AT }, { opacity: 0 }]
138
- : [{ opacity: 1 }, { opacity: 1 }];
139
- const tight = fades
140
- ? [{ opacity: 0 }, { opacity: 1, offset: TIGHT_GLOW_AT }, { opacity: 0 }]
141
- : [{ opacity: 0 }, { opacity: 0 }];
148
+ const easeGlow = easingLookup(engine)(config.highlight.glowEasing);
149
+ const ramp = swipeRamp(config);
142
150
  return cells.flatMap((cell, cellIndex) => {
143
151
  const span = cell.span ?? { start: cellIndex / cells.length, width: 1 / cells.length };
144
- const delayMs = followsSwipe
145
- ? Math.max(0, cellReachedAt(swipeRamp(config), span) * swipeDurationMs - swipeLeadMs)
146
- : 0;
152
+ const delayMs = followsSwipe ? Math.max(0, cellReachedAt(ramp, span) * swipeDurationMs - swipeLeadMs) : 0;
153
+ const litMs = followsSwipe ? cellLitAt(ramp, span) * swipeDurationMs - swipeLeadMs : delayMs;
154
+ const riseMs = Math.max(0, litMs - delayMs);
155
+ const peak = durationMs > 0 ? Math.min(easeGlow(riseMs / durationMs), LATEST_GLOW_PEAK) : 0;
147
156
  const timing = {
148
157
  delay: delayMs,
149
158
  duration: durationMs,
@@ -151,12 +160,25 @@ function sweepGlow(word, cells, durationMs, followsSwipe) {
151
160
  fill: fades ? "none" : "forwards",
152
161
  };
153
162
  const currentTimeMs = scheduledTimeMs(word, word.elapsedMs, delayMs + durationMs);
163
+ const halos = haloKeyframes(fades, peak);
154
164
  return cell.glows.map((halo, index) => {
155
- const fade = halo.glow.animate(index === 0 ? wide : tight, timing);
165
+ const fade = halo.glow.animate(index === 0 ? halos.wide : halos.tight, timing);
166
+ glowDelaysMs.set(fade, delayMs);
156
167
  return followSong(word, fade, currentTimeMs, { skipDriftSample: true });
157
168
  });
158
169
  });
159
170
  }
171
+ function haloKeyframes(fades, peak) {
172
+ const rises = peak > 0;
173
+ const wideRise = rises ? [{ opacity: 0 }, { opacity: 1, offset: peak }] : [{ opacity: 1 }];
174
+ const tightWait = rises ? [{ opacity: 0 }, { opacity: 0, offset: peak }] : [{ opacity: 0 }];
175
+ if (!fades)
176
+ return { wide: [...wideRise, { opacity: 1 }], tight: [{ opacity: 0 }, { opacity: 0 }] };
177
+ return {
178
+ wide: [...wideRise, { opacity: 0, offset: TIGHT_GLOW_AT }, { opacity: 0 }],
179
+ tight: [...tightWait, { opacity: 1, offset: TIGHT_GLOW_AT }, { opacity: 0 }],
180
+ };
181
+ }
160
182
  function wobble(word) {
161
183
  const { wobbleFrom, wobblePeak, wobblePeakOffset, wobblePeakEasing, wobbleSettle, wobbleSettleOffset } = word.config.word;
162
184
  const { wobbleTo, wobbleEndEasing, wobbleDurationMs, wobbleEasing } = word.config.word;
package/dist/view.js CHANGED
@@ -17,7 +17,7 @@ import {} from "./engine/instance.js";
17
17
  import { elementMotionOffsetPx } from "./engine/elementMotion.js";
18
18
  import { replaceRenderedLines } from "./engine/renderedLines.js";
19
19
  import { playerTimeForLyricTime } from "./engine/clock.js";
20
- import { setupLineCulling } from "./engine/culling.js";
20
+ import { setupLineCullObserver } from "./engine/culling.js";
21
21
  import { addSeekHandler, applyDirection, buildLineSyncedParts, createLyricsLine, deriveSyncType, disableRichsync, findNearestAgent, hideCredits, isNearestLyricRtl, moveDecorations, newLineData, } from "./inject.js";
22
22
  import { refreshInstrumentalImages } from "./imageHighlights.js";
23
23
  import { createInstrumentalElement } from "./instrumental.js";
@@ -231,7 +231,7 @@ export function setLyrics(engine, mount, lyrics, options) {
231
231
  // sizes it by.
232
232
  engine.lyricWidth = container.clientWidth;
233
233
  engine.lyricHeight = container.clientHeight;
234
- setupLineCulling(engine);
234
+ setupLineCullObserver(engine);
235
235
  }
236
236
  /**
237
237
  * Pairs each new line with an old one that builds the same, keeping their order, so a kept element is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braccato/core",
3
- "version": "1.21.3",
3
+ "version": "1.21.5",
4
4
  "description": "Synchronized lyrics renderer with word-by-word animations",
5
5
  "type": "module",
6
6
  "license": "MIT",