@braccato/core 1.19.1 → 1.20.1
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.
- package/dist/engine/animationConfig.d.ts +88 -0
- package/dist/engine/animationConfig.js +98 -0
- package/dist/engine/animationDrift.d.ts +11 -0
- package/dist/engine/animationDrift.js +43 -0
- package/dist/engine/animationTiming.d.ts +25 -0
- package/dist/engine/animationTiming.js +119 -0
- package/dist/engine/autoScroll.d.ts +24 -0
- package/dist/engine/autoScroll.js +103 -0
- package/dist/engine/clock.d.ts +29 -0
- package/dist/engine/clock.js +70 -0
- package/dist/engine/cssValues.d.ts +13 -0
- package/dist/engine/cssValues.js +47 -0
- package/dist/engine/culling.d.ts +6 -0
- package/dist/engine/culling.js +67 -0
- package/dist/engine/debugOverlay.d.ts +14 -0
- package/dist/engine/debugOverlay.js +58 -0
- package/dist/engine/decorationSlides.d.ts +6 -0
- package/dist/engine/decorationSlides.js +44 -0
- package/dist/engine/glow.d.ts +7 -0
- package/dist/engine/glow.js +59 -0
- package/dist/engine/highlightKeyframes.d.ts +8 -0
- package/dist/engine/highlightKeyframes.js +37 -0
- package/dist/engine/instance.d.ts +102 -0
- package/dist/engine/instance.js +87 -0
- package/dist/engine/instrumentalAnimations.d.ts +7 -0
- package/dist/engine/instrumentalAnimations.js +59 -0
- package/dist/engine/letterPlans.d.ts +42 -0
- package/dist/engine/letterPlans.js +103 -0
- package/dist/engine/lineAnimationState.d.ts +10 -0
- package/dist/engine/lineAnimationState.js +85 -0
- package/dist/engine/lineAnimations.d.ts +5 -0
- package/dist/engine/lineAnimations.js +82 -0
- package/dist/engine/lineLifecycle.d.ts +12 -0
- package/dist/engine/lineLifecycle.js +92 -0
- package/dist/engine/lineScroll.d.ts +48 -0
- package/dist/engine/lineScroll.js +174 -0
- package/dist/engine/lineScrollStyle.d.ts +27 -0
- package/dist/engine/lineScrollStyle.js +119 -0
- package/dist/engine/liveViews.d.ts +3 -0
- package/dist/engine/liveViews.js +5 -0
- package/dist/engine/motionPreference.d.ts +1 -0
- package/dist/engine/motionPreference.js +1 -0
- package/dist/engine/passiveScroll.d.ts +10 -0
- package/dist/engine/passiveScroll.js +93 -0
- package/dist/engine/renderedLines.d.ts +17 -0
- package/dist/engine/renderedLines.js +137 -0
- package/dist/engine/scrollViewport.d.ts +36 -0
- package/dist/engine/scrollViewport.js +104 -0
- package/dist/engine/stageMotion.d.ts +7 -0
- package/dist/engine/stageMotion.js +319 -0
- package/dist/engine/tick.d.ts +13 -0
- package/dist/engine/tick.js +246 -0
- package/dist/engine/timingLogs.d.ts +7 -0
- package/dist/engine/timingLogs.js +81 -0
- package/dist/engine/userScroll.d.ts +12 -0
- package/dist/engine/userScroll.js +62 -0
- package/dist/engine/wavePool.d.ts +8 -0
- package/dist/engine/wavePool.js +22 -0
- package/dist/engine/wordAnimations.d.ts +9 -0
- package/dist/engine/wordAnimations.js +216 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/inject.js +40 -22
- package/dist/renderer.js +8 -2
- package/dist/types.d.ts +1 -1
- package/dist/view.d.ts +2 -2
- package/dist/view.js +7 -3
- package/package.json +2 -2
- package/dist/engine.d.ts +0 -471
- package/dist/engine.js +0 -3133
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { clamp, toMs } from "../util.js";
|
|
2
|
+
import { dropPendingLineScroll } from "./lineScroll.js";
|
|
3
|
+
export function clearStyleCaches(engine) {
|
|
4
|
+
dropPendingLineScroll(engine);
|
|
5
|
+
engine.cachedDurations.clear();
|
|
6
|
+
engine.cachedCSSValues.clear();
|
|
7
|
+
engine.cachedAnimationSettings = null;
|
|
8
|
+
engine.cachedLineScrollTiming.clear();
|
|
9
|
+
}
|
|
10
|
+
// Property-only caching assumes every lookup for this engine uses its lyrics container.
|
|
11
|
+
export function getCSSValue(engine, lyricsElement, property, fallback) {
|
|
12
|
+
let value = engine.cachedCSSValues.get(property);
|
|
13
|
+
if (value === undefined) {
|
|
14
|
+
value = engine.window.getComputedStyle(lyricsElement).getPropertyValue(property).trim() || fallback;
|
|
15
|
+
engine.cachedCSSValues.set(property, value);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
export function getCSSDurationInMs(engine, lyricsElement, property) {
|
|
20
|
+
let duration = engine.cachedDurations.get(property);
|
|
21
|
+
if (duration === undefined) {
|
|
22
|
+
duration = toMs(getCSSValue(engine, lyricsElement, property, "0ms"));
|
|
23
|
+
engine.cachedDurations.set(property, duration);
|
|
24
|
+
}
|
|
25
|
+
return duration;
|
|
26
|
+
}
|
|
27
|
+
export function getCSSNumber(engine, lyricsElement, property, fallback) {
|
|
28
|
+
const value = Number.parseFloat(getCSSValue(engine, lyricsElement, property, `${fallback}`));
|
|
29
|
+
return Number.isFinite(value) ? value : fallback;
|
|
30
|
+
}
|
|
31
|
+
export function createThemeReader(engine, lyricsElement) {
|
|
32
|
+
const string = (property, fallback) => getCSSValue(engine, lyricsElement, property, fallback);
|
|
33
|
+
const number = (property, fallback) => getCSSNumber(engine, lyricsElement, property, fallback);
|
|
34
|
+
return {
|
|
35
|
+
string,
|
|
36
|
+
number,
|
|
37
|
+
durationMs: (property, fallback) => Math.max(toMs(string(property, fallback)), 1),
|
|
38
|
+
fraction: (property, fallback) => clamp(number(property, fallback), 0, 1),
|
|
39
|
+
flag: (property, fallback) => {
|
|
40
|
+
const value = string(property, fallback ? "1" : "0").toLowerCase();
|
|
41
|
+
if (value === "false" || value === "off" || value === "none")
|
|
42
|
+
return false;
|
|
43
|
+
const numeric = Number.parseFloat(value);
|
|
44
|
+
return Number.isFinite(numeric) ? numeric > 0 : fallback;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
2
|
+
import { type LineScrollItem } from "./lineScroll.js";
|
|
3
|
+
export declare function setupLineCullObserver(engine: AnimationEngineInstance): void;
|
|
4
|
+
export declare function clearOffscreenLineCulling(engine: AnimationEngineInstance): void;
|
|
5
|
+
export declare function updateVisibleLyricWillChange(engine: AnimationEngineInstance, lines: LineScrollItem[], fromScrollTop: number, toScrollTop: number, viewportHeight: number): void;
|
|
6
|
+
export declare function clearVisibleLyricWillChange(engine: AnimationEngineInstance): void;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { isLineVisibleDuringScroll, LINE_SCROLL_WILL_CHANGE_VALUE } from "./lineScroll.js";
|
|
2
|
+
// Use screen intersections because transformed scrolling decouples layout coordinates from visibility.
|
|
3
|
+
const ONE_VIEWPORT_OVERSCAN = "100% 0px 100% 0px";
|
|
4
|
+
export function setupLineCullObserver(engine) {
|
|
5
|
+
engine.lineCullObserver?.disconnect();
|
|
6
|
+
engine.lineCullObserver = null;
|
|
7
|
+
clearOffscreenLineCulling(engine);
|
|
8
|
+
const Observer = engine.window.IntersectionObserver;
|
|
9
|
+
if (engine.layout === "stage" || typeof Observer !== "function" || engine.lines.length === 0)
|
|
10
|
+
return;
|
|
11
|
+
// The engine owns scrollTop; Firefox's scroll anchoring would answer cull height shifts with a scroll the
|
|
12
|
+
// engine reads as the user's.
|
|
13
|
+
engine.host.getScrollElement()?.style.setProperty("overflow-anchor", "none");
|
|
14
|
+
pinCulledLineHeights(engine);
|
|
15
|
+
const observer = new Observer(entries => {
|
|
16
|
+
for (const entry of entries) {
|
|
17
|
+
const element = entry.target;
|
|
18
|
+
if (entry.isIntersecting) {
|
|
19
|
+
if (engine.culledLineElements.delete(element))
|
|
20
|
+
uncullLine(element);
|
|
21
|
+
}
|
|
22
|
+
else if (!engine.culledLineElements.has(element)) {
|
|
23
|
+
cullLine(element);
|
|
24
|
+
engine.culledLineElements.add(element);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, { root: null, rootMargin: ONE_VIEWPORT_OVERSCAN, threshold: 0 });
|
|
28
|
+
for (const line of engine.lines)
|
|
29
|
+
observer.observe(line.lyricElement);
|
|
30
|
+
engine.lineCullObserver = observer;
|
|
31
|
+
}
|
|
32
|
+
export function clearOffscreenLineCulling(engine) {
|
|
33
|
+
for (const element of engine.culledLineElements)
|
|
34
|
+
uncullLine(element);
|
|
35
|
+
engine.culledLineElements = new Set();
|
|
36
|
+
}
|
|
37
|
+
function pinCulledLineHeights(engine) {
|
|
38
|
+
const renderedHeights = engine.lines.map(line => line.lyricElement.offsetHeight);
|
|
39
|
+
engine.lines.forEach((line, index) => {
|
|
40
|
+
line.lyricElement.style.setProperty("contain-intrinsic-block-size", `auto ${renderedHeights[index]}px`);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function cullLine(element) {
|
|
44
|
+
element.style.setProperty("content-visibility", "auto");
|
|
45
|
+
}
|
|
46
|
+
function uncullLine(element) {
|
|
47
|
+
element.style.removeProperty("content-visibility");
|
|
48
|
+
}
|
|
49
|
+
export function updateVisibleLyricWillChange(engine, lines, fromScrollTop, toScrollTop, viewportHeight) {
|
|
50
|
+
const visibleElements = new Set();
|
|
51
|
+
for (const line of lines) {
|
|
52
|
+
if (!isLineVisibleDuringScroll(line, fromScrollTop, toScrollTop, viewportHeight))
|
|
53
|
+
continue;
|
|
54
|
+
line.lyricElement.style.setProperty("will-change", LINE_SCROLL_WILL_CHANGE_VALUE);
|
|
55
|
+
visibleElements.add(line.lyricElement);
|
|
56
|
+
}
|
|
57
|
+
for (const element of engine.visibleWillChangeElements) {
|
|
58
|
+
if (!visibleElements.has(element))
|
|
59
|
+
element.style.removeProperty("will-change");
|
|
60
|
+
}
|
|
61
|
+
engine.visibleWillChangeElements = visibleElements;
|
|
62
|
+
}
|
|
63
|
+
export function clearVisibleLyricWillChange(engine) {
|
|
64
|
+
for (const element of engine.visibleWillChangeElements)
|
|
65
|
+
element.style.removeProperty("will-change");
|
|
66
|
+
engine.visibleWillChangeElements = new Set();
|
|
67
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LineData } from "../inject.js";
|
|
2
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
3
|
+
export interface ScrollDebugFrame {
|
|
4
|
+
lyricsElement: HTMLElement;
|
|
5
|
+
scrollTop: number;
|
|
6
|
+
viewportHeight: number;
|
|
7
|
+
targetOffset: number;
|
|
8
|
+
followedLines: LineData[];
|
|
9
|
+
lineCenters: number[];
|
|
10
|
+
scrollTimeS: number;
|
|
11
|
+
endingThresholdS: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function isDebugOverlayEnabled(): boolean;
|
|
14
|
+
export declare function drawScrollDebugOverlay(engine: AnimationEngineInstance, frame: ScrollDebugFrame): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { registerThemeSetting } from "../themeSettings.js";
|
|
2
|
+
const DEBUG_OVERLAY_ENABLED = registerThemeSetting("blyrics-debug-renderer", false);
|
|
3
|
+
const GUIDE_START_X = 40;
|
|
4
|
+
const GUIDE_END_X = 1000;
|
|
5
|
+
const LAST_SCROLL_COLUMN_X = 160;
|
|
6
|
+
export function isDebugOverlayEnabled() {
|
|
7
|
+
return DEBUG_OVERLAY_ENABLED.getBooleanValue();
|
|
8
|
+
}
|
|
9
|
+
export function drawScrollDebugOverlay(engine, frame) {
|
|
10
|
+
const transform = engine.window.getComputedStyle(frame.lyricsElement).transform;
|
|
11
|
+
const viewTop = frame.scrollTop - new engine.window.DOMMatrix(transform).f;
|
|
12
|
+
const ctx = engine.host.debug?.beginFrame(viewTop);
|
|
13
|
+
if (!ctx)
|
|
14
|
+
return;
|
|
15
|
+
const guide = (color, label, y) => {
|
|
16
|
+
ctx.strokeStyle = color;
|
|
17
|
+
ctx.fillStyle = color;
|
|
18
|
+
ctx.fillText(label, 0, y);
|
|
19
|
+
ctx.beginPath();
|
|
20
|
+
ctx.moveTo(GUIDE_START_X, y);
|
|
21
|
+
ctx.lineTo(GUIDE_END_X, y);
|
|
22
|
+
ctx.stroke();
|
|
23
|
+
};
|
|
24
|
+
guide("green", "visible top", frame.scrollTop);
|
|
25
|
+
guide("blue", "visible bottom", frame.scrollTop + frame.viewportHeight);
|
|
26
|
+
guide("yellow", "target", frame.scrollTop + frame.targetOffset);
|
|
27
|
+
const last = engine.lastScrollDebugContext;
|
|
28
|
+
drawLineColumn(ctx, viewTop, 0, "realtime", frame.followedLines, frame.lineCenters, frame.scrollTimeS, frame);
|
|
29
|
+
drawLineColumn(ctx, viewTop, LAST_SCROLL_COLUMN_X, "last scroll", last.activeElms, last.centers, last.lyricScrollTime, frame);
|
|
30
|
+
}
|
|
31
|
+
function drawLineColumn(ctx, viewTop, x, title, lines, centers, scrollTimeS, { endingThresholdS }) {
|
|
32
|
+
ctx.strokeStyle = "red";
|
|
33
|
+
ctx.fillStyle = "red";
|
|
34
|
+
ctx.fillText(title, x + 2, viewTop + 45);
|
|
35
|
+
ctx.fillText(`scroll time: ${scrollTimeS.toFixed(3)}`, x + 2, viewTop + 60);
|
|
36
|
+
for (const line of lines) {
|
|
37
|
+
const untilStartS = line.time - scrollTimeS;
|
|
38
|
+
const endS = line.time + line.duration;
|
|
39
|
+
const untilEndS = endS - scrollTimeS;
|
|
40
|
+
const color = untilEndS < endingThresholdS ? "gray" : untilStartS > 0 ? "magenta" : "orange";
|
|
41
|
+
ctx.strokeStyle = color;
|
|
42
|
+
ctx.fillStyle = color;
|
|
43
|
+
ctx.beginPath();
|
|
44
|
+
ctx.moveTo(x + 5, line.position);
|
|
45
|
+
ctx.lineTo(x + 5, line.position + line.height);
|
|
46
|
+
ctx.stroke();
|
|
47
|
+
ctx.fillText(`time: start=${line.time.toFixed(2)} end=${endS.toFixed(2)}`, x + 15, line.position);
|
|
48
|
+
ctx.fillText(`till active: ${untilStartS.toFixed(2)}`, x + 15, line.position + 15);
|
|
49
|
+
ctx.fillText(`till end: ${untilEndS.toFixed(2)}`, x + 15, line.position + 30);
|
|
50
|
+
}
|
|
51
|
+
ctx.strokeStyle = "pink";
|
|
52
|
+
ctx.fillStyle = "pink";
|
|
53
|
+
for (const center of centers) {
|
|
54
|
+
ctx.beginPath();
|
|
55
|
+
ctx.arc(x + 5, center, 5, 0, 2 * Math.PI, false);
|
|
56
|
+
ctx.fill();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
2
|
+
export declare const DECORATION_MIN_SHIFT_PX = 0.5;
|
|
3
|
+
export declare function slideElementBy(element: HTMLElement, dy: number): void;
|
|
4
|
+
export declare function decorationSlideAllowed(engine: AnimationEngineInstance, container: HTMLElement): boolean;
|
|
5
|
+
export declare function lineDecorators(lineElement: HTMLElement): HTMLElement[];
|
|
6
|
+
export declare function captureDecorationSlide(engine: AnimationEngineInstance): (() => void) | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ROMANIZED_LYRICS_CLASS, TRANSLATED_LYRICS_CLASS } from "../constants.js";
|
|
2
|
+
import { REDUCED_MOTION_QUERY } from "./motionPreference.js";
|
|
3
|
+
const DECORATION_SLIDE_MS = 350;
|
|
4
|
+
const DECORATION_SLIDE_EASING = "cubic-bezier(0.25, 1, 0.5, 1)";
|
|
5
|
+
export const DECORATION_MIN_SHIFT_PX = 0.5;
|
|
6
|
+
export function slideElementBy(element, dy) {
|
|
7
|
+
element.animate({ translate: [`0 ${dy}px`, "0 0"] }, { duration: DECORATION_SLIDE_MS, easing: DECORATION_SLIDE_EASING, composite: "add" });
|
|
8
|
+
}
|
|
9
|
+
export function decorationSlideAllowed(engine, container) {
|
|
10
|
+
if (engine.window.matchMedia(REDUCED_MOTION_QUERY).matches)
|
|
11
|
+
return false;
|
|
12
|
+
return (engine.window.getComputedStyle(container).getPropertyValue("--blyrics-animate-decoration-entry").trim() !== "0");
|
|
13
|
+
}
|
|
14
|
+
export function lineDecorators(lineElement) {
|
|
15
|
+
return [
|
|
16
|
+
...lineElement.querySelectorAll(`.${ROMANIZED_LYRICS_CLASS}`),
|
|
17
|
+
...lineElement.querySelectorAll(`.${TRANSLATED_LYRICS_CLASS}`),
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
export function captureDecorationSlide(engine) {
|
|
21
|
+
const container = engine.lyricsContainer;
|
|
22
|
+
if (!container || engine.layout === "stage" || !decorationSlideAllowed(engine, container))
|
|
23
|
+
return null;
|
|
24
|
+
const before = engine.lines.map(line => ({
|
|
25
|
+
line,
|
|
26
|
+
position: line.position,
|
|
27
|
+
decorations: new Map(line.decorations),
|
|
28
|
+
}));
|
|
29
|
+
return () => {
|
|
30
|
+
for (const { line, position, decorations } of before) {
|
|
31
|
+
const lineShift = position - line.position;
|
|
32
|
+
if (Math.abs(lineShift) >= DECORATION_MIN_SHIFT_PX)
|
|
33
|
+
slideElementBy(line.lyricElement, lineShift);
|
|
34
|
+
for (const [element, was] of decorations) {
|
|
35
|
+
const now = line.decorations.get(element);
|
|
36
|
+
if (now === undefined)
|
|
37
|
+
continue;
|
|
38
|
+
const ownShift = was - now - lineShift;
|
|
39
|
+
if (Math.abs(ownShift) >= DECORATION_MIN_SHIFT_PX)
|
|
40
|
+
slideElementBy(element, ownShift);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LineData } from "../inject.js";
|
|
2
|
+
import type { AnimationConfig } from "./animationConfig.js";
|
|
3
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
4
|
+
export declare function resolveGlowFilter(engine: AnimationEngineInstance, lyricsElement: HTMLElement, end: "from" | "to", defaultRadius: string): string;
|
|
5
|
+
export declare function isGlowRestingInvisible(glowTo: string): boolean;
|
|
6
|
+
export declare function suppressInvisibleWordGlows(engine: AnimationEngineInstance, line: LineData, config: AnimationConfig): void;
|
|
7
|
+
export declare function parseColorAlpha(value: string): number | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { clamp } from "../util.js";
|
|
2
|
+
import { getCSSValue } from "./cssValues.js";
|
|
3
|
+
const HALF_8BIT_ALPHA_STEP = 0.5 / 255;
|
|
4
|
+
// Keep var(--blyrics-glow-color) unresolved so each animated word supplies its color. Reading a composed
|
|
5
|
+
// filter from the container would bake in the container's color.
|
|
6
|
+
export function resolveGlowFilter(engine, lyricsElement, end, defaultRadius) {
|
|
7
|
+
const override = getCSSValue(engine, lyricsElement, `--blyrics-highlight-glow-filter-${end}`, "");
|
|
8
|
+
if (override)
|
|
9
|
+
return override;
|
|
10
|
+
const radius = getCSSValue(engine, lyricsElement, `--blyrics-highlight-glow-radius-${end}`, defaultRadius);
|
|
11
|
+
return `drop-shadow(0 0 ${radius} var(--blyrics-glow-color))`;
|
|
12
|
+
}
|
|
13
|
+
export function isGlowRestingInvisible(glowTo) {
|
|
14
|
+
const value = glowTo.trim();
|
|
15
|
+
if (value === "" || value === "none")
|
|
16
|
+
return true;
|
|
17
|
+
const engineDropShadow = value.match(/^drop-shadow\(\s*0\s+0\s+(\S+)\s+var\(--blyrics-glow-color\)\)$/);
|
|
18
|
+
return engineDropShadow ? Number.parseFloat(engineDropShadow[1]) === 0 : false;
|
|
19
|
+
}
|
|
20
|
+
export function suppressInvisibleWordGlows(engine, line, config) {
|
|
21
|
+
const containerGlowShows = config.highlight.glowContainerAlpha >= HALF_8BIT_ALPHA_STEP;
|
|
22
|
+
if (containerGlowShows || line.parts.some(part => part.imageLayers)) {
|
|
23
|
+
for (const part of line.parts)
|
|
24
|
+
part.glowSuppressed = false;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
for (const part of line.parts) {
|
|
28
|
+
const color = engine.window.getComputedStyle(part.highlightElement).getPropertyValue("--blyrics-glow-color");
|
|
29
|
+
const alpha = parseColorAlpha(color) ?? 1;
|
|
30
|
+
part.glowSuppressed = alpha < HALF_8BIT_ALPHA_STEP;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function parseColorAlpha(value) {
|
|
34
|
+
const color = value.trim().toLowerCase();
|
|
35
|
+
if (color === "")
|
|
36
|
+
return null;
|
|
37
|
+
if (color === "transparent")
|
|
38
|
+
return 0;
|
|
39
|
+
const slashAlpha = color.match(/\/\s*([0-9]*\.?[0-9]+%?)\s*\)\s*$/);
|
|
40
|
+
if (slashAlpha)
|
|
41
|
+
return alphaToken(slashAlpha[1]);
|
|
42
|
+
const commaAlpha = color.match(/^(?:rgba|hsla)\([^)]*,\s*([0-9]*\.?[0-9]+%?)\s*\)$/);
|
|
43
|
+
if (commaAlpha)
|
|
44
|
+
return alphaToken(commaAlpha[1]);
|
|
45
|
+
const hexWithAlpha = color.match(/^#([0-9a-f]{4}|[0-9a-f]{8})$/);
|
|
46
|
+
if (hexWithAlpha) {
|
|
47
|
+
const digits = hexWithAlpha[1];
|
|
48
|
+
const alphaHex = digits.length === 8 ? digits.slice(6) : digits.slice(3).repeat(2);
|
|
49
|
+
return Number.parseInt(alphaHex, 16) / 255;
|
|
50
|
+
}
|
|
51
|
+
const opaqueFunction = /^(?:rgb|hsl|hwb|lab|lch|oklab|oklch|color)\(/.test(color);
|
|
52
|
+
const opaqueHex = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/.test(color);
|
|
53
|
+
const namedColor = /^[a-z]+$/.test(color);
|
|
54
|
+
return opaqueFunction || opaqueHex || namedColor ? 1 : null;
|
|
55
|
+
}
|
|
56
|
+
function alphaToken(token) {
|
|
57
|
+
const value = token.endsWith("%") ? Number.parseFloat(token) / 100 : Number.parseFloat(token);
|
|
58
|
+
return clamp(value, 0, 1);
|
|
59
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PartData } from "../inject.js";
|
|
2
|
+
import type { AnimationConfig } from "./animationConfig.js";
|
|
3
|
+
export declare function swipeKeyframes(config: AnimationConfig): Keyframe[];
|
|
4
|
+
export declare function glowKeyframes({ highlight }: AnimationConfig, part: PartData): Keyframe[];
|
|
5
|
+
export declare function shownKeyframes(): Keyframe[];
|
|
6
|
+
export declare function shownFullySweptKeyframes(config: AnimationConfig): Keyframe[];
|
|
7
|
+
export declare function fadeInFullySweptKeyframes(config: AnimationConfig): Keyframe[];
|
|
8
|
+
export declare function fadeOutKeyframes(config: AnimationConfig, part: PartData): Keyframe[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function swipeAmounts({ highlight }, end) {
|
|
2
|
+
return {
|
|
3
|
+
"--lyric-transition-amount-start": end === "from" ? highlight.swipeStartFrom : highlight.swipeStartTo,
|
|
4
|
+
"--lyric-transition-amount-end": end === "from" ? highlight.swipeEndFrom : highlight.swipeEndTo,
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function swipeKeyframes(config) {
|
|
8
|
+
return [swipeAmounts(config, "from"), swipeAmounts(config, "to")];
|
|
9
|
+
}
|
|
10
|
+
export function glowKeyframes({ highlight }, part) {
|
|
11
|
+
if (!part.imageLayers)
|
|
12
|
+
return [{ filter: highlight.glowFrom }, { filter: highlight.glowTo }];
|
|
13
|
+
return [
|
|
14
|
+
{ filter: `blur(${highlight.imageGlowFrom})`, opacity: highlight.imageGlowOpacityFrom },
|
|
15
|
+
{ filter: `blur(${highlight.imageGlowTo})`, opacity: highlight.imageGlowOpacityTo },
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
export function shownKeyframes() {
|
|
19
|
+
return [{ opacity: 1 }, { opacity: 1 }];
|
|
20
|
+
}
|
|
21
|
+
export function shownFullySweptKeyframes(config) {
|
|
22
|
+
const shown = { opacity: 1, ...swipeAmounts(config, "to") };
|
|
23
|
+
return [shown, shown];
|
|
24
|
+
}
|
|
25
|
+
export function fadeInFullySweptKeyframes(config) {
|
|
26
|
+
return [
|
|
27
|
+
{ opacity: 0, ...swipeAmounts(config, "to") },
|
|
28
|
+
{ opacity: 1, ...swipeAmounts(config, "to") },
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
export function fadeOutKeyframes(config, part) {
|
|
32
|
+
const filter = part.imageLayers ? "none" : config.highlight.glowTo;
|
|
33
|
+
return [
|
|
34
|
+
{ opacity: 1, filter, ...swipeAmounts(config, "to") },
|
|
35
|
+
{ opacity: 0, filter, ...swipeAmounts(config, "to") },
|
|
36
|
+
];
|
|
37
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { LineData } from "../inject.js";
|
|
2
|
+
import type { LyricsLayout, LyricsRendererHost, LyricSyncType, ResolvedTickOptions } from "../types.js";
|
|
3
|
+
import type { StageBox, StageMetrics } from "../stage.js";
|
|
4
|
+
import { type ScrollInsets } from "./scrollViewport.js";
|
|
5
|
+
import type { LineScrollAnimationRecord, LineScrollItem, PendingLineScroll } from "./lineScroll.js";
|
|
6
|
+
import type { LineScrollTiming } from "./lineScrollStyle.js";
|
|
7
|
+
import type { AnimationSettings } from "./animationConfig.js";
|
|
8
|
+
/**
|
|
9
|
+
* Everything that belongs to a single rendered lyrics view: one scroll container, one selection,
|
|
10
|
+
* one set of pending scroll work.
|
|
11
|
+
*/
|
|
12
|
+
interface AnimEngineViewState {
|
|
13
|
+
/**
|
|
14
|
+
* The render records this view built, one per lyric line. They hold this view's elements and
|
|
15
|
+
* this view's `Animation` objects, so a second view never shares them.
|
|
16
|
+
*/
|
|
17
|
+
lines: LineData[];
|
|
18
|
+
lyricsContainer: HTMLElement | null;
|
|
19
|
+
syncType: LyricSyncType;
|
|
20
|
+
lyricWidth: number;
|
|
21
|
+
lyricHeight: number;
|
|
22
|
+
skipScrolls: number;
|
|
23
|
+
skipScrollsDecayTimes: number[];
|
|
24
|
+
scrollResumeTime: number;
|
|
25
|
+
scrollPos: number;
|
|
26
|
+
selectedElementIndex: number;
|
|
27
|
+
wasUserScrolling: boolean;
|
|
28
|
+
lastScrollElements: LineData[];
|
|
29
|
+
/** The line a committed scroll kept in view because the active lines overflowed the band. */
|
|
30
|
+
pinnedScrollLine: LineData | null;
|
|
31
|
+
lastScrollDebugContext: {
|
|
32
|
+
activeElms: LineData[];
|
|
33
|
+
centers: number[];
|
|
34
|
+
lyricScrollTime: number;
|
|
35
|
+
};
|
|
36
|
+
passiveScrollAccumulatedTime: number;
|
|
37
|
+
passiveLastWallTime: number;
|
|
38
|
+
/** Where the passive drift last put the scroll, so a scroll that lands anywhere else is the reader's. */
|
|
39
|
+
passiveScrollTop: number | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* `Window` alone types neither `ResizeObserver` nor `DOMMatrix`: both are ambient `var`
|
|
43
|
+
* declarations, so they only appear through `typeof globalThis`.
|
|
44
|
+
*/
|
|
45
|
+
type EngineWindow = Window & typeof globalThis;
|
|
46
|
+
export interface AnimationEngineInstance extends AnimEngineViewState {
|
|
47
|
+
document: Document;
|
|
48
|
+
window: EngineWindow;
|
|
49
|
+
host: LyricsRendererHost;
|
|
50
|
+
cachedTabRendererHeight: number | null;
|
|
51
|
+
cachedScrollInsets: ScrollInsets;
|
|
52
|
+
cachedFooterItem: LineScrollItem | null;
|
|
53
|
+
cachedCreditsItem: LineScrollItem | null;
|
|
54
|
+
creditsFocused: boolean;
|
|
55
|
+
cachedLineScrollTiming: Map<string, LineScrollTiming>;
|
|
56
|
+
tabRendererResizeObserver: ResizeObserver | null;
|
|
57
|
+
observedTabRenderer: HTMLElement | null;
|
|
58
|
+
lineScrollAnimations: LineScrollAnimationRecord[];
|
|
59
|
+
lineScrollAnimationToken: number;
|
|
60
|
+
pendingLineScroll: PendingLineScroll | null;
|
|
61
|
+
lineScrollElementTokens: WeakMap<HTMLElement, number>;
|
|
62
|
+
visibleWillChangeElements: Set<HTMLElement>;
|
|
63
|
+
culledLineElements: Set<HTMLElement>;
|
|
64
|
+
waveAnimationPool: Animation[];
|
|
65
|
+
lineCullObserver: IntersectionObserver | null;
|
|
66
|
+
cachedDurations: Map<string, number>;
|
|
67
|
+
cachedCSSValues: Map<string, string>;
|
|
68
|
+
cachedAnimationSettings: AnimationSettings | null;
|
|
69
|
+
/**
|
|
70
|
+
* Last value the tick was given. The passive scroll loop runs from an animation frame rather than
|
|
71
|
+
* from a tick, so it has no options object to read.
|
|
72
|
+
*/
|
|
73
|
+
passiveScrollEnabled: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Last options the tick was given, kept before any early return. A click reads its offsets to seek
|
|
76
|
+
* to where a line plays rather than to its unshifted time.
|
|
77
|
+
*/
|
|
78
|
+
lastTickOptions: ResolvedTickOptions | null;
|
|
79
|
+
playbackRate: number;
|
|
80
|
+
passiveRAFId: number | null;
|
|
81
|
+
pendingLyricsUpdateFrame: number | null;
|
|
82
|
+
learnedAnimationTimingOffsetMs: number;
|
|
83
|
+
animationTimingVisibilityLogUntil: number;
|
|
84
|
+
layout: LyricsLayout;
|
|
85
|
+
stageKey: string;
|
|
86
|
+
stageRemeasured: boolean;
|
|
87
|
+
stageHeight: number;
|
|
88
|
+
stageBox: StageBox | null;
|
|
89
|
+
stageMetrics: Map<HTMLElement, StageMetrics>;
|
|
90
|
+
stageY: Map<HTMLElement, number>;
|
|
91
|
+
stageMoves: Map<HTMLElement, Animation>;
|
|
92
|
+
stageFades: Map<HTMLElement, Animation>;
|
|
93
|
+
stageBlurs: Map<HTMLElement, Animation>;
|
|
94
|
+
stageFontSize: number;
|
|
95
|
+
/**
|
|
96
|
+
* Releases everything the instance holds on its window: the reduced motion listener, the tab
|
|
97
|
+
* renderer observer and any frame it still has queued.
|
|
98
|
+
*/
|
|
99
|
+
destroy(): void;
|
|
100
|
+
}
|
|
101
|
+
export declare function createAnimationEngineInstance(engineDocument: Document, engineWindow: EngineWindow, host: LyricsRendererHost, layout?: LyricsLayout): AnimationEngineInstance;
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { NO_SCROLL_INSETS } from "./scrollViewport.js";
|
|
2
|
+
import { REDUCED_MOTION_QUERY } from "./motionPreference.js";
|
|
3
|
+
import { clearStyleCaches } from "./cssValues.js";
|
|
4
|
+
import { liveEngines } from "./liveViews.js";
|
|
5
|
+
import { stopPassiveScrollLoop } from "./passiveScroll.js";
|
|
6
|
+
import { cancelLyricPositionUpdate } from "./tick.js";
|
|
7
|
+
export function createAnimationEngineInstance(engineDocument, engineWindow, host, layout = "scroll") {
|
|
8
|
+
const reducedMotionQuery = engineWindow.matchMedia(REDUCED_MOTION_QUERY);
|
|
9
|
+
const handleReducedMotionChange = () => clearStyleCaches(engine);
|
|
10
|
+
const engine = {
|
|
11
|
+
document: engineDocument,
|
|
12
|
+
window: engineWindow,
|
|
13
|
+
host,
|
|
14
|
+
lines: [],
|
|
15
|
+
lyricsContainer: null,
|
|
16
|
+
syncType: "none",
|
|
17
|
+
lyricWidth: 0,
|
|
18
|
+
lyricHeight: 0,
|
|
19
|
+
skipScrolls: 0,
|
|
20
|
+
skipScrollsDecayTimes: [],
|
|
21
|
+
scrollResumeTime: 0,
|
|
22
|
+
scrollPos: -1,
|
|
23
|
+
selectedElementIndex: 0,
|
|
24
|
+
wasUserScrolling: false,
|
|
25
|
+
lastScrollElements: [],
|
|
26
|
+
pinnedScrollLine: null,
|
|
27
|
+
lastScrollDebugContext: {
|
|
28
|
+
activeElms: [],
|
|
29
|
+
centers: [],
|
|
30
|
+
lyricScrollTime: 0,
|
|
31
|
+
},
|
|
32
|
+
passiveScrollAccumulatedTime: 0,
|
|
33
|
+
passiveLastWallTime: 0,
|
|
34
|
+
passiveScrollTop: null,
|
|
35
|
+
cachedTabRendererHeight: null,
|
|
36
|
+
cachedScrollInsets: NO_SCROLL_INSETS,
|
|
37
|
+
cachedFooterItem: null,
|
|
38
|
+
cachedCreditsItem: null,
|
|
39
|
+
creditsFocused: false,
|
|
40
|
+
cachedLineScrollTiming: new Map(),
|
|
41
|
+
tabRendererResizeObserver: null,
|
|
42
|
+
observedTabRenderer: null,
|
|
43
|
+
lineScrollAnimations: [],
|
|
44
|
+
lineScrollAnimationToken: 0,
|
|
45
|
+
pendingLineScroll: null,
|
|
46
|
+
lineScrollElementTokens: new WeakMap(),
|
|
47
|
+
visibleWillChangeElements: new Set(),
|
|
48
|
+
culledLineElements: new Set(),
|
|
49
|
+
waveAnimationPool: [],
|
|
50
|
+
lineCullObserver: null,
|
|
51
|
+
cachedDurations: new Map(),
|
|
52
|
+
cachedCSSValues: new Map(),
|
|
53
|
+
cachedAnimationSettings: null,
|
|
54
|
+
passiveScrollEnabled: false,
|
|
55
|
+
lastTickOptions: null,
|
|
56
|
+
playbackRate: 1,
|
|
57
|
+
passiveRAFId: null,
|
|
58
|
+
pendingLyricsUpdateFrame: null,
|
|
59
|
+
learnedAnimationTimingOffsetMs: 0,
|
|
60
|
+
animationTimingVisibilityLogUntil: 0,
|
|
61
|
+
layout,
|
|
62
|
+
stageKey: "",
|
|
63
|
+
stageRemeasured: false,
|
|
64
|
+
stageHeight: 0,
|
|
65
|
+
stageBox: null,
|
|
66
|
+
stageMetrics: new Map(),
|
|
67
|
+
stageY: new Map(),
|
|
68
|
+
stageMoves: new Map(),
|
|
69
|
+
stageFades: new Map(),
|
|
70
|
+
stageBlurs: new Map(),
|
|
71
|
+
stageFontSize: 16,
|
|
72
|
+
destroy: () => {
|
|
73
|
+
liveEngines.delete(engine);
|
|
74
|
+
reducedMotionQuery.removeEventListener("change", handleReducedMotionChange);
|
|
75
|
+
engine.tabRendererResizeObserver?.disconnect();
|
|
76
|
+
engine.tabRendererResizeObserver = null;
|
|
77
|
+
engine.observedTabRenderer = null;
|
|
78
|
+
engine.lineCullObserver?.disconnect();
|
|
79
|
+
engine.lineCullObserver = null;
|
|
80
|
+
stopPassiveScrollLoop(engine);
|
|
81
|
+
cancelLyricPositionUpdate(engine);
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
reducedMotionQuery.addEventListener("change", handleReducedMotionChange);
|
|
85
|
+
liveEngines.add(engine);
|
|
86
|
+
return engine;
|
|
87
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LineData } from "../inject.js";
|
|
2
|
+
import type { AnimationConfig } from "./animationConfig.js";
|
|
3
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
4
|
+
export declare const INSTRUMENTAL_WAVE_PATH_HIGH_FALLBACK = "path(\"M -4 3 Q 1 2 5 3 Q 10 4 14 3 Q 18 2 22 3 Q 26 4 30 3 L 30 4 L -4 4 Z\")";
|
|
5
|
+
export declare const INSTRUMENTAL_WAVE_PATH_LOW_FALLBACK = "path(\"M -4 3 Q 1 4 5 3 Q 10 2 14 3 Q 18 4 22 3 Q 26 2 30 3 L 30 4 L -4 4 Z\")";
|
|
6
|
+
export declare function startInstrumentalAnimations(engine: AnimationEngineInstance, line: LineData, config: AnimationConfig, lyricTimeS: number, appliedTimingOffsetMs: number): void;
|
|
7
|
+
export declare function startInstrumentalExitAnimations(line: LineData, config: AnimationConfig, lyricTimeS: number): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { INSTRUMENTAL_WAVE_PATH_HIGH, INSTRUMENTAL_WAVE_PATH_LOW } from "../instrumental.js";
|
|
2
|
+
import { correctedAnimationTimeMs, correctedWrappedAnimationTimeMs, followSongClock } from "./animationTiming.js";
|
|
3
|
+
const FILL_SELECTOR = ".blyrics--instrumental-fill";
|
|
4
|
+
const WAVE_CLIP_SELECTOR = ".blyrics--wave-clip";
|
|
5
|
+
const WAVE_PATH_SELECTOR = ".blyrics--wave-path";
|
|
6
|
+
const INSTANT_MS = 1;
|
|
7
|
+
export const INSTRUMENTAL_WAVE_PATH_HIGH_FALLBACK = `path("${INSTRUMENTAL_WAVE_PATH_HIGH}")`;
|
|
8
|
+
export const INSTRUMENTAL_WAVE_PATH_LOW_FALLBACK = `path("${INSTRUMENTAL_WAVE_PATH_LOW}")`;
|
|
9
|
+
export function startInstrumentalAnimations(engine, line, config, lyricTimeS, appliedTimingOffsetMs) {
|
|
10
|
+
const elapsedMs = (lyricTimeS - line.time) * 1000;
|
|
11
|
+
const lineDurationMs = Math.max(line.duration * 1000, 1);
|
|
12
|
+
const enabled = config.enabled.instrumental;
|
|
13
|
+
const { instrumental } = config;
|
|
14
|
+
const followSong = (animation, currentTimeMs, wrapDurationMs) => {
|
|
15
|
+
if (!animation)
|
|
16
|
+
return;
|
|
17
|
+
followSongClock(engine, animation, { appliedTimingOffsetMs, offsetMs: 0, wrapDurationMs });
|
|
18
|
+
animation.currentTime = currentTimeMs;
|
|
19
|
+
};
|
|
20
|
+
const scheduled = (durationMs) => correctedAnimationTimeMs(elapsedMs, appliedTimingOffsetMs, durationMs);
|
|
21
|
+
const fillFadeMs = enabled ? instrumental.fillFadeDurationMs : INSTANT_MS;
|
|
22
|
+
const fillFade = animateChild(line, FILL_SELECTOR, [{ opacity: 0 }, { opacity: 1 }], {
|
|
23
|
+
duration: fillFadeMs,
|
|
24
|
+
easing: enabled ? instrumental.fillFadeEasing : "linear",
|
|
25
|
+
fill: "forwards",
|
|
26
|
+
});
|
|
27
|
+
followSong(fillFade, scheduled(fillFadeMs));
|
|
28
|
+
if (!enabled)
|
|
29
|
+
return;
|
|
30
|
+
const travel = (selector, from, to, easing) => animateChild(line, selector, [{ transform: from }, { transform: to }], {
|
|
31
|
+
duration: lineDurationMs,
|
|
32
|
+
easing,
|
|
33
|
+
fill: "both",
|
|
34
|
+
});
|
|
35
|
+
followSong(travel(WAVE_CLIP_SELECTOR, instrumental.fillFrom, instrumental.fillTo, instrumental.fillEasing), scheduled(lineDurationMs));
|
|
36
|
+
followSong(travel(WAVE_PATH_SELECTOR, instrumental.waveFrom, instrumental.waveTo, instrumental.waveEasing), scheduled(lineDurationMs));
|
|
37
|
+
const oscillationMs = instrumental.waveOscillationDurationMs;
|
|
38
|
+
const oscillation = animateChild(line, WAVE_PATH_SELECTOR, [{ d: instrumental.wavePathHigh }, { d: instrumental.wavePathLow, offset: 0.5 }, { d: instrumental.wavePathHigh }], { duration: oscillationMs, easing: instrumental.waveOscillationEasing, iterations: Infinity });
|
|
39
|
+
const wrapMs = Math.max(oscillationMs, 1);
|
|
40
|
+
followSong(oscillation, correctedWrappedAnimationTimeMs(elapsedMs, appliedTimingOffsetMs, wrapMs), oscillationMs);
|
|
41
|
+
}
|
|
42
|
+
export function startInstrumentalExitAnimations(line, config, lyricTimeS) {
|
|
43
|
+
if (lyricTimeS < line.time)
|
|
44
|
+
return;
|
|
45
|
+
const fades = config.enabled.instrumental && config.enabled.highlightFade;
|
|
46
|
+
animateChild(line, FILL_SELECTOR, [{ opacity: 1 }, { opacity: 0 }], {
|
|
47
|
+
duration: fades ? config.highlight.fadeOutDurationMs : INSTANT_MS,
|
|
48
|
+
easing: config.enabled.instrumental ? config.highlight.fadeOutEasing : "linear",
|
|
49
|
+
fill: "none",
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function animateChild(line, selector, keyframes, options) {
|
|
53
|
+
const element = line.lyricElement.querySelector(selector);
|
|
54
|
+
if (!element)
|
|
55
|
+
return null;
|
|
56
|
+
const animation = element.animate(keyframes, options);
|
|
57
|
+
line.animations.push(animation);
|
|
58
|
+
return animation;
|
|
59
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AnimationConfig } from "./animationConfig.js";
|
|
2
|
+
export interface SwipeRamp {
|
|
3
|
+
easing: string;
|
|
4
|
+
startFrom: string;
|
|
5
|
+
startTo: string;
|
|
6
|
+
endFrom: string;
|
|
7
|
+
endTo: string;
|
|
8
|
+
}
|
|
9
|
+
export interface LetterSwipeWindow {
|
|
10
|
+
delayMs: number;
|
|
11
|
+
durationMs: number;
|
|
12
|
+
from: {
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
};
|
|
16
|
+
to: {
|
|
17
|
+
start: number;
|
|
18
|
+
end: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface LetterMaskKeyframe {
|
|
22
|
+
offset: number;
|
|
23
|
+
maskPosition: string;
|
|
24
|
+
}
|
|
25
|
+
export interface LetterMaskSweep {
|
|
26
|
+
keyframes: LetterMaskKeyframe[];
|
|
27
|
+
delayMs: number;
|
|
28
|
+
durationMs: number;
|
|
29
|
+
easing: string;
|
|
30
|
+
}
|
|
31
|
+
export interface LetterWaveTiming {
|
|
32
|
+
delayMs: number;
|
|
33
|
+
durationMs: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const LETTER_WAVE_CREST_OFFSET = 0.4;
|
|
36
|
+
export declare const GECKO_REDRAW: boolean;
|
|
37
|
+
export declare const GECKO_REDRAW_KEYFRAMES: Keyframe[];
|
|
38
|
+
export declare const GECKO_REDRAW_PERIOD_MS = 200;
|
|
39
|
+
export declare function swipeRamp({ highlight }: AnimationConfig): SwipeRamp;
|
|
40
|
+
export declare function linearForwardSwipeWindows(swipe: SwipeRamp, letterCount: number, swipeDurationMs: number): LetterSwipeWindow[] | null;
|
|
41
|
+
export declare function planLetterMaskSweep(swipe: SwipeRamp, letterCount: number, swipeDurationMs: number, rtl: boolean): LetterMaskSweep[];
|
|
42
|
+
export declare function planLetterWave(swipe: SwipeRamp, letterCount: number, wordDurationMs: number, swipeDurationMs: number, swipeLeadMs: number, floatDurationMs: number): LetterWaveTiming[];
|