@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,88 @@
|
|
|
1
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
2
|
+
export interface AnimationConfig {
|
|
3
|
+
enabled: {
|
|
4
|
+
lineScale: boolean;
|
|
5
|
+
wordWobble: boolean;
|
|
6
|
+
highlightSwipe: boolean;
|
|
7
|
+
highlightGlow: boolean;
|
|
8
|
+
highlightFade: boolean;
|
|
9
|
+
scroll: boolean;
|
|
10
|
+
instrumental: boolean;
|
|
11
|
+
};
|
|
12
|
+
line: {
|
|
13
|
+
durationMs: number;
|
|
14
|
+
enterEasing: string;
|
|
15
|
+
exitEasing: string;
|
|
16
|
+
enterFrom: string;
|
|
17
|
+
enterTo: string;
|
|
18
|
+
exitFrom: string;
|
|
19
|
+
exitTo: string;
|
|
20
|
+
};
|
|
21
|
+
highlight: {
|
|
22
|
+
fadeInDurationMs: number;
|
|
23
|
+
fadeOutDurationMs: number;
|
|
24
|
+
fadeInEasing: string;
|
|
25
|
+
fadeOutEasing: string;
|
|
26
|
+
swipeEasing: string;
|
|
27
|
+
swipeStartFrom: string;
|
|
28
|
+
swipeEndFrom: string;
|
|
29
|
+
swipeStartTo: string;
|
|
30
|
+
swipeEndTo: string;
|
|
31
|
+
imageGlowFrom: string;
|
|
32
|
+
imageGlowTo: string;
|
|
33
|
+
imageGlowOpacityFrom: string;
|
|
34
|
+
imageGlowOpacityTo: string;
|
|
35
|
+
glowFrom: string;
|
|
36
|
+
glowTo: string;
|
|
37
|
+
glowDurationRatio: number;
|
|
38
|
+
glowMinDurationMs: number;
|
|
39
|
+
glowEasing: string;
|
|
40
|
+
glowContainerAlpha: number;
|
|
41
|
+
glowRestingInvisible: boolean;
|
|
42
|
+
};
|
|
43
|
+
word: {
|
|
44
|
+
wobbleDurationMs: number;
|
|
45
|
+
wobbleEasing: string;
|
|
46
|
+
wobblePeakEasing: string;
|
|
47
|
+
wobbleEndEasing: string;
|
|
48
|
+
wobbleFrom: string;
|
|
49
|
+
wobblePeak: string;
|
|
50
|
+
wobbleSettle: string;
|
|
51
|
+
wobbleTo: string;
|
|
52
|
+
wobblePeakOffset: number;
|
|
53
|
+
wobbleSettleOffset: number;
|
|
54
|
+
};
|
|
55
|
+
letterWave: {
|
|
56
|
+
transform: string;
|
|
57
|
+
settle: string;
|
|
58
|
+
emphasisScale: string;
|
|
59
|
+
durationMs: number;
|
|
60
|
+
riseEasing: string;
|
|
61
|
+
fallEasing: string;
|
|
62
|
+
};
|
|
63
|
+
instrumental: {
|
|
64
|
+
fillFadeDurationMs: number;
|
|
65
|
+
fillFadeEasing: string;
|
|
66
|
+
fillFrom: string;
|
|
67
|
+
fillTo: string;
|
|
68
|
+
fillEasing: string;
|
|
69
|
+
waveFrom: string;
|
|
70
|
+
waveTo: string;
|
|
71
|
+
waveEasing: string;
|
|
72
|
+
wavePathHigh: string;
|
|
73
|
+
wavePathLow: string;
|
|
74
|
+
waveOscillationDurationMs: number;
|
|
75
|
+
waveOscillationEasing: string;
|
|
76
|
+
};
|
|
77
|
+
lineScroll: {
|
|
78
|
+
easing: string;
|
|
79
|
+
differentialEffects: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface AnimationSettings {
|
|
83
|
+
config: AnimationConfig;
|
|
84
|
+
scrollTiming: {
|
|
85
|
+
earlyScrollConsiderS: number;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export declare function getAnimationSettings(engine: AnimationEngineInstance, lyricsElement: HTMLElement): AnimationSettings;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { registerThemeSetting } from "../themeSettings.js";
|
|
2
|
+
import { REDUCED_MOTION_QUERY } from "./motionPreference.js";
|
|
3
|
+
import { createThemeReader } from "./cssValues.js";
|
|
4
|
+
import { isGlowRestingInvisible, parseColorAlpha, resolveGlowFilter } from "./glow.js";
|
|
5
|
+
import { INSTRUMENTAL_WAVE_PATH_HIGH_FALLBACK, INSTRUMENTAL_WAVE_PATH_LOW_FALLBACK } from "./instrumentalAnimations.js";
|
|
6
|
+
const EARLY_SCROLL_CONSIDER = registerThemeSetting("blyrics-early-scroll-consider-s", 0.54);
|
|
7
|
+
const DEFAULT_SCROLL_EASING = "cubic-bezier(0.86, 0, 0.2, 1)";
|
|
8
|
+
export function getAnimationSettings(engine, lyricsElement) {
|
|
9
|
+
engine.cachedAnimationSettings ??= {
|
|
10
|
+
config: readAnimationConfig(engine, lyricsElement),
|
|
11
|
+
scrollTiming: { earlyScrollConsiderS: Math.max(0, EARLY_SCROLL_CONSIDER.getNumberValue()) },
|
|
12
|
+
};
|
|
13
|
+
return engine.cachedAnimationSettings;
|
|
14
|
+
}
|
|
15
|
+
function readAnimationConfig(engine, lyricsElement) {
|
|
16
|
+
const css = createThemeReader(engine, lyricsElement);
|
|
17
|
+
const glowTo = resolveGlowFilter(engine, lyricsElement, "to", "0");
|
|
18
|
+
return {
|
|
19
|
+
enabled: {
|
|
20
|
+
lineScale: css.flag("--blyrics-animate-line-scale", true),
|
|
21
|
+
wordWobble: css.flag("--blyrics-animate-word-wobble", true),
|
|
22
|
+
highlightSwipe: css.flag("--blyrics-animate-highlight-swipe", true),
|
|
23
|
+
highlightGlow: css.flag("--blyrics-animate-highlight-glow", true),
|
|
24
|
+
highlightFade: css.flag("--blyrics-animate-highlight-fade", true),
|
|
25
|
+
scroll: css.flag("--blyrics-animate-scroll", true),
|
|
26
|
+
instrumental: css.flag("--blyrics-animate-instrumental", true),
|
|
27
|
+
},
|
|
28
|
+
line: {
|
|
29
|
+
durationMs: css.durationMs("--blyrics-scale-transition-duration", "0.166s"),
|
|
30
|
+
enterEasing: css.string("--blyrics-line-enter-easing", "ease"),
|
|
31
|
+
exitEasing: css.string("--blyrics-line-exit-easing", "ease"),
|
|
32
|
+
enterFrom: css.string("--blyrics-line-enter-transform-from", "scale(var(--blyrics-scale))"),
|
|
33
|
+
enterTo: css.string("--blyrics-line-enter-transform-to", "scale(var(--blyrics-active-scale))"),
|
|
34
|
+
exitFrom: css.string("--blyrics-line-exit-transform-from", "scale(var(--blyrics-active-scale))"),
|
|
35
|
+
exitTo: css.string("--blyrics-line-exit-transform-to", "scale(var(--blyrics-scale))"),
|
|
36
|
+
},
|
|
37
|
+
highlight: {
|
|
38
|
+
fadeInDurationMs: css.durationMs("--blyrics-lyric-highlight-fade-in-duration", "0.33s"),
|
|
39
|
+
fadeOutDurationMs: css.durationMs("--blyrics-lyric-highlight-fade-out-duration", "0.5s"),
|
|
40
|
+
fadeInEasing: css.string("--blyrics-lyric-highlight-fade-in-easing", "ease"),
|
|
41
|
+
fadeOutEasing: css.string("--blyrics-lyric-highlight-fade-out-easing", "ease"),
|
|
42
|
+
swipeEasing: css.string("--blyrics-highlight-swipe-easing", "linear"),
|
|
43
|
+
swipeStartFrom: css.string("--blyrics-highlight-swipe-start-from", "-0.2"),
|
|
44
|
+
swipeEndFrom: css.string("--blyrics-highlight-swipe-end-from", "-0.1"),
|
|
45
|
+
swipeStartTo: css.string("--blyrics-highlight-swipe-start-to", "1.4"),
|
|
46
|
+
swipeEndTo: css.string("--blyrics-highlight-swipe-end-to", "1.5"),
|
|
47
|
+
imageGlowFrom: css.string("--blyrics-highlight-glow-radius-from", "0.8rem"),
|
|
48
|
+
imageGlowTo: css.string("--blyrics-highlight-glow-radius-to", "0px"),
|
|
49
|
+
imageGlowOpacityFrom: css.string("--blyrics-image-glow-opacity-from", "0.5"),
|
|
50
|
+
imageGlowOpacityTo: css.string("--blyrics-image-glow-opacity-to", "0"),
|
|
51
|
+
glowFrom: resolveGlowFilter(engine, lyricsElement, "from", "0.8rem"),
|
|
52
|
+
glowTo,
|
|
53
|
+
glowDurationRatio: css.number("--blyrics-highlight-glow-duration-ratio", 1.2),
|
|
54
|
+
glowMinDurationMs: css.durationMs("--blyrics-highlight-glow-min-duration", "1.2s"),
|
|
55
|
+
glowEasing: css.string("--blyrics-highlight-glow-easing", "ease"),
|
|
56
|
+
glowContainerAlpha: parseColorAlpha(css.string("--blyrics-glow-color", "")) ?? 1,
|
|
57
|
+
glowRestingInvisible: isGlowRestingInvisible(glowTo),
|
|
58
|
+
},
|
|
59
|
+
word: {
|
|
60
|
+
wobbleDurationMs: css.durationMs("--blyrics-wobble-duration", "1s"),
|
|
61
|
+
wobbleEasing: css.string("--blyrics-word-wobble-easing", "ease"),
|
|
62
|
+
wobblePeakEasing: css.string("--blyrics-word-wobble-peak-easing", "ease-in-out"),
|
|
63
|
+
wobbleEndEasing: css.string("--blyrics-word-wobble-end-easing", "ease-out"),
|
|
64
|
+
wobbleFrom: css.string("--blyrics-word-wobble-transform-from", "scaleX(1)"),
|
|
65
|
+
wobblePeak: css.string("--blyrics-word-wobble-transform-peak", "translateX(0.05em) scaleX(1.025)"),
|
|
66
|
+
wobbleSettle: css.string("--blyrics-word-wobble-transform-settle", "translateX(0) scaleX(1)"),
|
|
67
|
+
wobbleTo: css.string("--blyrics-word-wobble-transform-to", "scaleX(1)"),
|
|
68
|
+
wobblePeakOffset: css.fraction("--blyrics-word-wobble-peak-offset", 0.125),
|
|
69
|
+
wobbleSettleOffset: css.fraction("--blyrics-word-wobble-settle-offset", 0.75),
|
|
70
|
+
},
|
|
71
|
+
letterWave: {
|
|
72
|
+
transform: css.string("--blyrics-letter-wave-transform", "translateY(-0.06em)"),
|
|
73
|
+
settle: css.string("--blyrics-letter-wave-settle", "translateY(-0.05em)"),
|
|
74
|
+
emphasisScale: css.string("--blyrics-letter-wave-emphasis-scale", "1.08"),
|
|
75
|
+
durationMs: css.durationMs("--blyrics-letter-wave-duration", "0.9s"),
|
|
76
|
+
riseEasing: css.string("--blyrics-letter-wave-rise-easing", "ease-in-out"),
|
|
77
|
+
fallEasing: css.string("--blyrics-letter-wave-fall-easing", "ease-in-out"),
|
|
78
|
+
},
|
|
79
|
+
instrumental: {
|
|
80
|
+
fillFadeDurationMs: css.durationMs("--blyrics-instrumental-fill-fade-duration", "150ms"),
|
|
81
|
+
fillFadeEasing: css.string("--blyrics-instrumental-fill-fade-easing", "ease"),
|
|
82
|
+
fillFrom: css.string("--blyrics-instrumental-fill-transform-from", "translateY(78%)"),
|
|
83
|
+
fillTo: css.string("--blyrics-instrumental-fill-transform-to", "translateY(-4%)"),
|
|
84
|
+
fillEasing: css.string("--blyrics-instrumental-fill-easing", "linear"),
|
|
85
|
+
waveFrom: css.string("--blyrics-instrumental-wave-transform-from", "scaleY(1.2)"),
|
|
86
|
+
waveTo: css.string("--blyrics-instrumental-wave-transform-to", "scaleY(0.0001)"),
|
|
87
|
+
waveEasing: css.string("--blyrics-instrumental-wave-easing", "ease-in"),
|
|
88
|
+
wavePathHigh: css.string("--blyrics-instrumental-wave-path-high", INSTRUMENTAL_WAVE_PATH_HIGH_FALLBACK),
|
|
89
|
+
wavePathLow: css.string("--blyrics-instrumental-wave-path-low", INSTRUMENTAL_WAVE_PATH_LOW_FALLBACK),
|
|
90
|
+
waveOscillationDurationMs: css.durationMs("--blyrics-instrumental-wave-oscillation-duration", "1.25s"),
|
|
91
|
+
waveOscillationEasing: css.string("--blyrics-instrumental-wave-oscillation-easing", "ease-in-out"),
|
|
92
|
+
},
|
|
93
|
+
lineScroll: {
|
|
94
|
+
easing: css.string("--blyrics-lyric-scroll-timing-function", DEFAULT_SCROLL_EASING),
|
|
95
|
+
differentialEffects: !engine.window.matchMedia(REDUCED_MOTION_QUERY).matches,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LineData } from "../inject.js";
|
|
2
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
3
|
+
export interface DriftCheck {
|
|
4
|
+
engine: AnimationEngineInstance;
|
|
5
|
+
line: LineData;
|
|
6
|
+
lineIndex: number;
|
|
7
|
+
lyricTimeS: number;
|
|
8
|
+
isPlaying: boolean;
|
|
9
|
+
now: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function correctLineDrift({ engine, line, lineIndex, lyricTimeS, isPlaying, now }: DriftCheck): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { clamp } from "../util.js";
|
|
2
|
+
import { largestDriftSample } from "./animationTiming.js";
|
|
3
|
+
import { resetLineAnimationState } from "./lineAnimationState.js";
|
|
4
|
+
import { logAnimationTiming, shouldLogAnimationTiming } from "./timingLogs.js";
|
|
5
|
+
const LEARN_RATE = 0.08;
|
|
6
|
+
const LEARN_SAMPLE_LIMIT_MS = 80;
|
|
7
|
+
const MAX_LEARNED_OFFSET_MS = 80;
|
|
8
|
+
const ACCUMULATION_DECAY = 1.08;
|
|
9
|
+
const ACCUMULATION_WEIGHT = 0.4;
|
|
10
|
+
const RESET_THRESHOLD_MS = 100;
|
|
11
|
+
export function correctLineDrift({ engine, line, lineIndex, lyricTimeS, isPlaying, now }) {
|
|
12
|
+
const sample = largestDriftSample(line, lyricTimeS);
|
|
13
|
+
line.accumulatedOffsetMs /= ACCUMULATION_DECAY;
|
|
14
|
+
if (sample === null)
|
|
15
|
+
return;
|
|
16
|
+
if (!isUsableForDrift(sample, isPlaying)) {
|
|
17
|
+
if (shouldLogAnimationTiming(engine, line, sample, now)) {
|
|
18
|
+
logAnimationTiming(engine, "ignored-sample", line, lineIndex, sample, lyricTimeS, line.accumulatedOffsetMs);
|
|
19
|
+
}
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const learnedOffsetMs = learnTimingOffset(engine, sample);
|
|
23
|
+
line.accumulatedOffsetMs += sample.offsetMs * ACCUMULATION_WEIGHT;
|
|
24
|
+
if (shouldLogAnimationTiming(engine, line, sample, now)) {
|
|
25
|
+
const accumulatedMs = line.accumulatedOffsetMs;
|
|
26
|
+
logAnimationTiming(engine, "sample", line, lineIndex, sample, lyricTimeS, accumulatedMs, learnedOffsetMs);
|
|
27
|
+
}
|
|
28
|
+
const drifted = Math.abs(line.accumulatedOffsetMs) > RESET_THRESHOLD_MS;
|
|
29
|
+
if (line.isAnimating && isPlaying && drifted) {
|
|
30
|
+
logAnimationTiming(engine, "drift-reset", line, lineIndex, sample, lyricTimeS, line.accumulatedOffsetMs);
|
|
31
|
+
resetLineAnimationState(line);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function isUsableForDrift(sample, isPlaying) {
|
|
35
|
+
return isPlaying && (sample.playState === "running" || sample.playState === "finished");
|
|
36
|
+
}
|
|
37
|
+
function learnTimingOffset(engine, sample) {
|
|
38
|
+
if (Math.abs(sample.biasOffsetMs) > LEARN_SAMPLE_LIMIT_MS)
|
|
39
|
+
return engine.learnedAnimationTimingOffsetMs;
|
|
40
|
+
const learned = engine.learnedAnimationTimingOffsetMs;
|
|
41
|
+
engine.learnedAnimationTimingOffsetMs = clamp(learned + (sample.biasOffsetMs - learned) * LEARN_RATE, -MAX_LEARNED_OFFSET_MS, MAX_LEARNED_OFFSET_MS);
|
|
42
|
+
return engine.learnedAnimationTimingOffsetMs;
|
|
43
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { LineData, PartData } from "../inject.js";
|
|
2
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
3
|
+
export interface SongClockTrack {
|
|
4
|
+
offsetMs: number;
|
|
5
|
+
appliedTimingOffsetMs: number;
|
|
6
|
+
skipDriftSample?: boolean;
|
|
7
|
+
wrapDurationMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface DriftSample {
|
|
10
|
+
actualTimeMs: number;
|
|
11
|
+
appliedTimingOffsetMs: number;
|
|
12
|
+
biasOffsetMs: number;
|
|
13
|
+
expectedTimeMs: number;
|
|
14
|
+
offsetMs: number;
|
|
15
|
+
playState: AnimationPlayState;
|
|
16
|
+
}
|
|
17
|
+
export declare function followSongClock(engine: AnimationEngineInstance, animation: Animation, track: Omit<SongClockTrack, "appliedTimingOffsetMs"> & {
|
|
18
|
+
appliedTimingOffsetMs?: number;
|
|
19
|
+
}): Animation;
|
|
20
|
+
export declare function mirrorImageHighlightAnimations(part: PartData, animations: Animation[]): Animation[];
|
|
21
|
+
export declare function applyPlaybackRateToRunningAnimations(engine: AnimationEngineInstance): void;
|
|
22
|
+
export declare function correctedAnimationTimeMs(targetTimeMs: number, appliedTimingOffsetMs: number, maxTimeMs?: number): number;
|
|
23
|
+
export declare function correctedWrappedAnimationTimeMs(targetTimeMs: number, appliedTimingOffsetMs: number, wrapDurationMs: number): number;
|
|
24
|
+
export declare function correctedScrollTimeS(engine: AnimationEngineInstance, lyricTimeS: number): number;
|
|
25
|
+
export declare function largestDriftSample(line: LineData, lyricTimeS: number): DriftSample | null;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { positiveModulo, toMs } from "../util.js";
|
|
2
|
+
const songClockTracks = new WeakMap();
|
|
3
|
+
export function followSongClock(engine, animation, track) {
|
|
4
|
+
songClockTracks.set(animation, {
|
|
5
|
+
...track,
|
|
6
|
+
appliedTimingOffsetMs: track.appliedTimingOffsetMs ?? engine.learnedAnimationTimingOffsetMs,
|
|
7
|
+
});
|
|
8
|
+
animation.playbackRate = engine.playbackRate;
|
|
9
|
+
return animation;
|
|
10
|
+
}
|
|
11
|
+
export function mirrorImageHighlightAnimations(part, animations) {
|
|
12
|
+
const target = part.imageLayers?.highlight;
|
|
13
|
+
if (!target)
|
|
14
|
+
return [];
|
|
15
|
+
const mirrors = [];
|
|
16
|
+
for (const animation of animations) {
|
|
17
|
+
const effect = animation.effect;
|
|
18
|
+
if (!effect || effect.target !== part.highlightElement)
|
|
19
|
+
continue;
|
|
20
|
+
const mirror = target.animate(effect.getKeyframes(), effect.getTiming());
|
|
21
|
+
mirror.playbackRate = animation.playbackRate;
|
|
22
|
+
mirror.currentTime = animation.currentTime;
|
|
23
|
+
const track = songClockTracks.get(animation);
|
|
24
|
+
if (track)
|
|
25
|
+
songClockTracks.set(mirror, { ...track, skipDriftSample: true });
|
|
26
|
+
mirrors.push(mirror);
|
|
27
|
+
}
|
|
28
|
+
return mirrors;
|
|
29
|
+
}
|
|
30
|
+
export function applyPlaybackRateToRunningAnimations(engine) {
|
|
31
|
+
const followRate = (animations) => {
|
|
32
|
+
for (const animation of animations) {
|
|
33
|
+
if (songClockTracks.has(animation))
|
|
34
|
+
animation.playbackRate = engine.playbackRate;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
for (const line of engine.lines) {
|
|
38
|
+
followRate(line.animations);
|
|
39
|
+
for (const part of line.parts)
|
|
40
|
+
followRate(part.animations);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function correctedAnimationTimeMs(targetTimeMs, appliedTimingOffsetMs, maxTimeMs) {
|
|
44
|
+
const scheduledTimeMs = targetTimeMs - appliedTimingOffsetMs;
|
|
45
|
+
return maxTimeMs === undefined ? scheduledTimeMs : Math.min(scheduledTimeMs, maxTimeMs);
|
|
46
|
+
}
|
|
47
|
+
export function correctedWrappedAnimationTimeMs(targetTimeMs, appliedTimingOffsetMs, wrapDurationMs) {
|
|
48
|
+
return positiveModulo(targetTimeMs - appliedTimingOffsetMs, wrapDurationMs);
|
|
49
|
+
}
|
|
50
|
+
export function correctedScrollTimeS(engine, lyricTimeS) {
|
|
51
|
+
return lyricTimeS - engine.learnedAnimationTimingOffsetMs / 1000;
|
|
52
|
+
}
|
|
53
|
+
export function largestDriftSample(line, lyricTimeS) {
|
|
54
|
+
let largest = accumulateLargestDriftSample(line, lyricTimeS, null);
|
|
55
|
+
for (const part of line.parts)
|
|
56
|
+
largest = accumulateLargestDriftSample(part, lyricTimeS, largest);
|
|
57
|
+
return largest;
|
|
58
|
+
}
|
|
59
|
+
function accumulateLargestDriftSample(part, lyricTimeS, largest) {
|
|
60
|
+
for (const animation of part.animations) {
|
|
61
|
+
const sample = driftSample(part, animation, lyricTimeS);
|
|
62
|
+
if (sample && (!largest || Math.abs(sample.offsetMs) > Math.abs(largest.offsetMs)))
|
|
63
|
+
largest = sample;
|
|
64
|
+
}
|
|
65
|
+
return largest;
|
|
66
|
+
}
|
|
67
|
+
function driftSample(part, animation, lyricTimeS) {
|
|
68
|
+
const track = songClockTracks.get(animation);
|
|
69
|
+
if (!track || track.skipDriftSample || animation.playState === "idle")
|
|
70
|
+
return null;
|
|
71
|
+
const rawActualTimeMs = timingValueToMs(animation.currentTime);
|
|
72
|
+
if (rawActualTimeMs === null)
|
|
73
|
+
return null;
|
|
74
|
+
const expectedTimeMs = normalizedTimeMs(animation, (lyricTimeS - part.time) * 1000 + track.offsetMs, track);
|
|
75
|
+
const actualTimeMs = normalizedTimeMs(animation, rawActualTimeMs, track);
|
|
76
|
+
if (expectedTimeMs === null || actualTimeMs === null)
|
|
77
|
+
return null;
|
|
78
|
+
const wrapDurationMs = track.wrapDurationMs ?? 0;
|
|
79
|
+
const offsetMs = wrapDurationMs > 0 ? wrappedOffsetMs(actualTimeMs, expectedTimeMs, wrapDurationMs) : actualTimeMs - expectedTimeMs;
|
|
80
|
+
return {
|
|
81
|
+
actualTimeMs,
|
|
82
|
+
appliedTimingOffsetMs: track.appliedTimingOffsetMs,
|
|
83
|
+
biasOffsetMs: offsetMs + track.appliedTimingOffsetMs,
|
|
84
|
+
expectedTimeMs,
|
|
85
|
+
offsetMs,
|
|
86
|
+
playState: animation.playState,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function normalizedTimeMs(animation, timeMs, track) {
|
|
90
|
+
if (!Number.isFinite(timeMs) || timeMs < 0)
|
|
91
|
+
return null;
|
|
92
|
+
if (track.wrapDurationMs && track.wrapDurationMs > 0)
|
|
93
|
+
return positiveModulo(timeMs, track.wrapDurationMs);
|
|
94
|
+
// Clamp to the effect's endTime, including delay/endDelay. Clamping to duration can hide drift in delayed
|
|
95
|
+
// letter waves.
|
|
96
|
+
const endTimeMs = timingValueToMs(animation.effect?.getComputedTiming().endTime);
|
|
97
|
+
return endTimeMs !== null && Number.isFinite(endTimeMs) ? Math.min(timeMs, endTimeMs) : timeMs;
|
|
98
|
+
}
|
|
99
|
+
function wrappedOffsetMs(actualTimeMs, expectedTimeMs, wrapDurationMs) {
|
|
100
|
+
return positiveModulo(actualTimeMs - expectedTimeMs + wrapDurationMs / 2, wrapDurationMs) - wrapDurationMs / 2;
|
|
101
|
+
}
|
|
102
|
+
function timingValueToMs(value) {
|
|
103
|
+
if (typeof value === "number")
|
|
104
|
+
return Number.isFinite(value) || value === Number.POSITIVE_INFINITY ? value : null;
|
|
105
|
+
if (typeof value === "string") {
|
|
106
|
+
const durationMs = toMs(value);
|
|
107
|
+
return durationMs > 0 ? durationMs : null;
|
|
108
|
+
}
|
|
109
|
+
const numeric = value;
|
|
110
|
+
if (typeof numeric?.to !== "function")
|
|
111
|
+
return null;
|
|
112
|
+
try {
|
|
113
|
+
const ms = numeric.to("ms").value;
|
|
114
|
+
return typeof ms === "number" && Number.isFinite(ms) ? ms : null;
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LineData } from "../inject.js";
|
|
2
|
+
import type { AnimationConfig } from "./animationConfig.js";
|
|
3
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
4
|
+
export interface ScrollerReading {
|
|
5
|
+
element: HTMLElement;
|
|
6
|
+
height: number;
|
|
7
|
+
scrollTop: number;
|
|
8
|
+
maxScrollTop: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AutoScrollTick {
|
|
11
|
+
engine: AnimationEngineInstance;
|
|
12
|
+
lyricsElement: HTMLElement;
|
|
13
|
+
scroller: ScrollerReading;
|
|
14
|
+
focusedLines: LineData[];
|
|
15
|
+
scrollTimeS: number;
|
|
16
|
+
config: AnimationConfig;
|
|
17
|
+
smoothScroll: boolean;
|
|
18
|
+
countEveryUserScroll: boolean;
|
|
19
|
+
jumped: boolean;
|
|
20
|
+
focusChanged: boolean;
|
|
21
|
+
now: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function followFocusedLines(tick: AutoScrollTick): void;
|
|
24
|
+
export declare function lastSungLine(engine: AnimationEngineInstance): LineData | undefined;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { USER_SCROLLING_CLASS } from "../constants.js";
|
|
2
|
+
import { registerThemeSetting } from "../themeSettings.js";
|
|
3
|
+
import { clamp } from "../util.js";
|
|
4
|
+
import { updateVisibleLyricWillChange } from "./culling.js";
|
|
5
|
+
import { drawScrollDebugOverlay, isDebugOverlayEnabled } from "./debugOverlay.js";
|
|
6
|
+
import { commitOrPrepareLineScroll, dropPendingLineScroll, getLineScrollItems, prepareUpcomingLineScroll, SCROLL_PREPARE_LEAD_MS, } from "./lineScroll.js";
|
|
7
|
+
import { computeActiveLinesScrollTop, findScrollAnchor, getTargetScrollRatio } from "./scrollViewport.js";
|
|
8
|
+
import { decaySkipScrolls, writeEngineScrollTop } from "./userScroll.js";
|
|
9
|
+
const LYRIC_ENDING_THRESHOLD_S = registerThemeSetting("blyrics-lyric-ending-threshold-s", 0.5);
|
|
10
|
+
const SCROLL_DEADBAND_PX = 2;
|
|
11
|
+
export function followFocusedLines(tick) {
|
|
12
|
+
const { engine, lyricsElement, now } = tick;
|
|
13
|
+
if (isAutoScrolling(engine, now))
|
|
14
|
+
scrollToFocusedLines(tick);
|
|
15
|
+
if (engine.wasUserScrolling && engine.scrollResumeTime < now) {
|
|
16
|
+
engine.host.setResumeAffordanceVisible(false);
|
|
17
|
+
lyricsElement.classList.remove(USER_SCROLLING_CLASS);
|
|
18
|
+
engine.wasUserScrolling = false;
|
|
19
|
+
}
|
|
20
|
+
decaySkipScrolls(engine, now, !tick.countEveryUserScroll);
|
|
21
|
+
}
|
|
22
|
+
function isAutoScrolling(engine, now) {
|
|
23
|
+
return engine.scrollResumeTime < now || engine.scrollPos === -1;
|
|
24
|
+
}
|
|
25
|
+
export function lastSungLine(engine) {
|
|
26
|
+
return engine.lines.findLast(line => line.lyricElement.dataset.instrumental !== "true");
|
|
27
|
+
}
|
|
28
|
+
function scrollToFocusedLines(tick) {
|
|
29
|
+
const { engine, lyricsElement, scroller, scrollTimeS, config, smoothScroll, jumped } = tick;
|
|
30
|
+
const followedLines = tick.focusedLines.length > 0 ? tick.focusedLines : engine.lines.slice(0, 1);
|
|
31
|
+
const leadLine = followedLines.at(-1);
|
|
32
|
+
if (!leadLine)
|
|
33
|
+
return;
|
|
34
|
+
const targetOffset = scroller.height * getTargetScrollRatio(engine, lyricsElement);
|
|
35
|
+
const endingThresholdS = LYRIC_ENDING_THRESHOLD_S.getNumberValue();
|
|
36
|
+
const sungLines = followedLines.filter(line => line === leadLine || scrollTimeS < line.time + line.duration - endingThresholdS);
|
|
37
|
+
const lineCenters = sungLines.map(line => line.position + line.height / 2);
|
|
38
|
+
const anchor = findScrollAnchor(sungLines, scrollTimeS);
|
|
39
|
+
const target = computeActiveLinesScrollTop(sungLines, anchor, scroller.height, engine.cachedScrollInsets, targetOffset);
|
|
40
|
+
const toScrollTop = clamp(creditsAwareScrollTop(engine, target.scrollTop, targetOffset), 0, scroller.maxScrollTop);
|
|
41
|
+
if (isDebugOverlayEnabled()) {
|
|
42
|
+
drawScrollDebugOverlay(engine, {
|
|
43
|
+
lyricsElement,
|
|
44
|
+
scrollTop: scroller.scrollTop,
|
|
45
|
+
viewportHeight: scroller.height,
|
|
46
|
+
targetOffset,
|
|
47
|
+
followedLines,
|
|
48
|
+
lineCenters,
|
|
49
|
+
scrollTimeS,
|
|
50
|
+
endingThresholdS,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const pinned = engine.pinnedScrollLine;
|
|
54
|
+
const pinnedLineFinished = pinned !== null &&
|
|
55
|
+
pinned !== anchor &&
|
|
56
|
+
(!sungLines.includes(pinned) || scrollTimeS >= pinned.time + pinned.duration);
|
|
57
|
+
const mustCommit = tick.focusChanged || pinnedLineFinished || engine.wasUserScrolling;
|
|
58
|
+
const fromScrollTop = scroller.scrollTop;
|
|
59
|
+
const moves = Math.abs(toScrollTop - fromScrollTop) > SCROLL_DEADBAND_PX;
|
|
60
|
+
const animatesScroll = smoothScroll && config.enabled.scroll;
|
|
61
|
+
const request = () => ({
|
|
62
|
+
lines: getLineScrollItems(engine, engine.lines),
|
|
63
|
+
activeLine: leadLine,
|
|
64
|
+
fromScrollTop,
|
|
65
|
+
toScrollTop,
|
|
66
|
+
viewportHeight: scroller.height,
|
|
67
|
+
config,
|
|
68
|
+
continuesEngineScroll: !jumped &&
|
|
69
|
+
!engine.wasUserScrolling &&
|
|
70
|
+
engine.scrollPos >= 0 &&
|
|
71
|
+
Math.abs(fromScrollTop - engine.scrollPos) <= SCROLL_DEADBAND_PX,
|
|
72
|
+
});
|
|
73
|
+
const msUntilLeadLine = (leadLine.time - scrollTimeS) * 1000;
|
|
74
|
+
const leadLineIsNext = msUntilLeadLine > 0 && msUntilLeadLine <= SCROLL_PREPARE_LEAD_MS;
|
|
75
|
+
if (animatesScroll && moves && !mustCommit && leadLineIsNext && !engine.lastScrollElements.includes(leadLine)) {
|
|
76
|
+
updateVisibleLyricWillChange(engine, engine.lines, fromScrollTop, toScrollTop, scroller.height);
|
|
77
|
+
prepareUpcomingLineScroll(engine, request());
|
|
78
|
+
}
|
|
79
|
+
if (!mustCommit)
|
|
80
|
+
return;
|
|
81
|
+
engine.lastScrollElements = followedLines;
|
|
82
|
+
engine.pinnedScrollLine = target.overflowsBand ? anchor : null;
|
|
83
|
+
engine.lastScrollDebugContext = { lyricScrollTime: scrollTimeS, centers: lineCenters, activeElms: followedLines };
|
|
84
|
+
if (smoothScroll && moves) {
|
|
85
|
+
if (config.enabled.scroll) {
|
|
86
|
+
updateVisibleLyricWillChange(engine, engine.lines, fromScrollTop, toScrollTop, scroller.height);
|
|
87
|
+
commitOrPrepareLineScroll(engine, request());
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
dropPendingLineScroll(engine);
|
|
92
|
+
}
|
|
93
|
+
writeEngineScrollTop(engine, scroller.element, toScrollTop, tick.now);
|
|
94
|
+
}
|
|
95
|
+
function creditsAwareScrollTop(engine, scrollTop, targetOffset) {
|
|
96
|
+
const credits = engine.cachedCreditsItem;
|
|
97
|
+
const lastLine = lastSungLine(engine);
|
|
98
|
+
if (!engine.creditsFocused || !credits || !lastLine)
|
|
99
|
+
return scrollTop;
|
|
100
|
+
const creditsCentered = credits.position + credits.height / 2 - targetOffset;
|
|
101
|
+
const lastLineAtTop = lastLine.position - engine.cachedScrollInsets.top;
|
|
102
|
+
return Math.min(creditsCentered, lastLineAtTop);
|
|
103
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ResolvedTickOptions } from "../types.js";
|
|
2
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
3
|
+
export declare const SMOOTH_PLAYBACK_CLOCK: boolean;
|
|
4
|
+
export declare const CLOCK_RESYNC_THRESHOLD_S = 0.06;
|
|
5
|
+
export declare const NO_PLAYER_SNAPSHOT = -1;
|
|
6
|
+
interface PlaybackClock {
|
|
7
|
+
lastTime: number;
|
|
8
|
+
lastPlayState: boolean;
|
|
9
|
+
lastEventCreationTime: number;
|
|
10
|
+
smoothedTime: number;
|
|
11
|
+
smoothedAt: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const playbackClock: PlaybackClock;
|
|
14
|
+
/**
|
|
15
|
+
* Clears the shared playback history when switching songs.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resetPlaybackClock(): void;
|
|
18
|
+
export declare function smoothedPlaybackTime(previousTime: number, previousAt: number, rawTime: number, now: number, playbackRate: number): number;
|
|
19
|
+
export interface Playhead {
|
|
20
|
+
timeS: number;
|
|
21
|
+
isPlaying: boolean;
|
|
22
|
+
jumped: boolean;
|
|
23
|
+
mediaClockRanBackwards: boolean;
|
|
24
|
+
seekedWhilePaused: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function advancePlaybackClock(reportedTimeS: number, { isPlaying, eventCreationTime, followPausedSeeks }: ResolvedTickOptions, playbackRate: number, now: number): Playhead;
|
|
27
|
+
export declare function lyricClockShiftS(engine: AnimationEngineInstance, lyricsElement: HTMLElement, options: ResolvedTickOptions): number;
|
|
28
|
+
export declare function playerTimeForLyricTime(engine: AnimationEngineInstance, lyricTimeS: number): number;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { isGecko } from "../util.js";
|
|
2
|
+
import { getCSSDurationInMs } from "./cssValues.js";
|
|
3
|
+
// Gecko has been seen to step media time about every 40 ms, so a read can lag by up to one step (never
|
|
4
|
+
// lead), and that lag would reseek lines as drift. A read off by more than a step plus margin is treated as
|
|
5
|
+
// a seek or a timer spike.
|
|
6
|
+
export const SMOOTH_PLAYBACK_CLOCK = isGecko();
|
|
7
|
+
export const CLOCK_RESYNC_THRESHOLD_S = 0.06;
|
|
8
|
+
const CLOCK_SLEW_PER_S = 0.1;
|
|
9
|
+
export const NO_PLAYER_SNAPSHOT = -1;
|
|
10
|
+
export const playbackClock = {
|
|
11
|
+
lastTime: 0,
|
|
12
|
+
lastPlayState: false,
|
|
13
|
+
lastEventCreationTime: NO_PLAYER_SNAPSHOT,
|
|
14
|
+
smoothedTime: 0,
|
|
15
|
+
smoothedAt: NO_PLAYER_SNAPSHOT,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Clears the shared playback history when switching songs.
|
|
19
|
+
*/
|
|
20
|
+
export function resetPlaybackClock() {
|
|
21
|
+
playbackClock.lastTime = 0;
|
|
22
|
+
playbackClock.lastPlayState = false;
|
|
23
|
+
playbackClock.lastEventCreationTime = NO_PLAYER_SNAPSHOT;
|
|
24
|
+
playbackClock.smoothedAt = NO_PLAYER_SNAPSHOT;
|
|
25
|
+
}
|
|
26
|
+
export function smoothedPlaybackTime(previousTime, previousAt, rawTime, now, playbackRate) {
|
|
27
|
+
if (previousAt === NO_PLAYER_SNAPSHOT)
|
|
28
|
+
return rawTime;
|
|
29
|
+
const elapsedS = Math.max(0, now - previousAt) / 1000;
|
|
30
|
+
const predictedTime = previousTime + elapsedS * playbackRate;
|
|
31
|
+
const errorS = rawTime - predictedTime;
|
|
32
|
+
if (errorS >= 0 || Math.abs(errorS) >= CLOCK_RESYNC_THRESHOLD_S)
|
|
33
|
+
return rawTime;
|
|
34
|
+
return predictedTime + errorS * Math.min(1, elapsedS * CLOCK_SLEW_PER_S);
|
|
35
|
+
}
|
|
36
|
+
const TIME_JUMP_THRESHOLD_S = 0.5;
|
|
37
|
+
export function advancePlaybackClock(reportedTimeS, { isPlaying, eventCreationTime, followPausedSeeks }, playbackRate, now) {
|
|
38
|
+
const snapshotGapS = (eventCreationTime - playbackClock.lastEventCreationTime) / 1000;
|
|
39
|
+
const jumped = Math.abs(reportedTimeS - playbackClock.lastTime - snapshotGapS) > TIME_JUMP_THRESHOLD_S;
|
|
40
|
+
const readsMediaClockDirectly = eventCreationTime === NO_PLAYER_SNAPSHOT;
|
|
41
|
+
const mediaClockRanBackwards = readsMediaClockDirectly && isPlaying && reportedTimeS < playbackClock.lastTime - CLOCK_RESYNC_THRESHOLD_S;
|
|
42
|
+
const seekedWhilePaused = followPausedSeeks && !isPlaying && !playbackClock.lastPlayState && reportedTimeS !== playbackClock.lastTime;
|
|
43
|
+
playbackClock.lastTime = reportedTimeS;
|
|
44
|
+
playbackClock.lastPlayState = isPlaying;
|
|
45
|
+
playbackClock.lastEventCreationTime = eventCreationTime;
|
|
46
|
+
const snapshotAgeS = isPlaying && !readsMediaClockDirectly ? (now - eventCreationTime) / 1000 : 0;
|
|
47
|
+
let timeS = reportedTimeS + snapshotAgeS;
|
|
48
|
+
if (SMOOTH_PLAYBACK_CLOCK) {
|
|
49
|
+
if (isPlaying && !jumped) {
|
|
50
|
+
timeS = smoothedPlaybackTime(playbackClock.smoothedTime, playbackClock.smoothedAt, timeS, now, playbackRate);
|
|
51
|
+
}
|
|
52
|
+
playbackClock.smoothedTime = timeS;
|
|
53
|
+
playbackClock.smoothedAt = isPlaying ? now : NO_PLAYER_SNAPSHOT;
|
|
54
|
+
}
|
|
55
|
+
return { timeS, isPlaying, jumped, mediaClockRanBackwards, seekedWhilePaused };
|
|
56
|
+
}
|
|
57
|
+
export function lyricClockShiftS(engine, lyricsElement, options) {
|
|
58
|
+
const syncTypeShiftS = engine.syncType === "richsync"
|
|
59
|
+
? getCSSDurationInMs(engine, lyricsElement, "--blyrics-richsync-timing-offset") / 1000 -
|
|
60
|
+
options.richsyncOffsetTrim
|
|
61
|
+
: getCSSDurationInMs(engine, lyricsElement, "--blyrics-timing-offset") / 1000 - options.lineOffsetTrim;
|
|
62
|
+
return syncTypeShiftS - options.globalLyricOffset - options.lyricOffset;
|
|
63
|
+
}
|
|
64
|
+
export function playerTimeForLyricTime(engine, lyricTimeS) {
|
|
65
|
+
const options = engine.lastTickOptions;
|
|
66
|
+
const lyricsElement = engine.lyricsContainer;
|
|
67
|
+
if (!options || !lyricsElement)
|
|
68
|
+
return lyricTimeS;
|
|
69
|
+
return Math.max(0, lyricTimeS - lyricClockShiftS(engine, lyricsElement, options));
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnimationEngineInstance } from "./instance.js";
|
|
2
|
+
export interface ThemeReader {
|
|
3
|
+
string(property: string, fallback: string): string;
|
|
4
|
+
durationMs(property: string, fallback: string): number;
|
|
5
|
+
number(property: string, fallback: number): number;
|
|
6
|
+
fraction(property: string, fallback: number): number;
|
|
7
|
+
flag(property: string, fallback: boolean): boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function clearStyleCaches(engine: AnimationEngineInstance): void;
|
|
10
|
+
export declare function getCSSValue(engine: AnimationEngineInstance, lyricsElement: HTMLElement, property: string, fallback: string): string;
|
|
11
|
+
export declare function getCSSDurationInMs(engine: AnimationEngineInstance, lyricsElement: HTMLElement, property: string): number;
|
|
12
|
+
export declare function getCSSNumber(engine: AnimationEngineInstance, lyricsElement: HTMLElement, property: string, fallback: number): number;
|
|
13
|
+
export declare function createThemeReader(engine: AnimationEngineInstance, lyricsElement: HTMLElement): ThemeReader;
|