feat: 优化歌词视觉效果
This commit is contained in:
1 parent
82b1fa0d47
commit
60fbbced7d
6 files changed
+532
-47
No files matched your search
+17
@@ -23,6 +23,7 @@ const DEFAULT_CREDIT_KEYWORDS = [
|
||||
const LRC_POSITIONS = ['top', 'center', 'bottom'];
|
||||
const LRC_ALIGNS = ['left', 'center', 'right'];
|
||||
const LRC_ANIMATIONS = ['none', 'fade', 'slide', 'zoom', 'blur', 'bounce', 'custom'];
|
||||
const LRC_OUTROS = ['none', 'fade', 'blur', 'slideDown', 'slideUp', 'zoom', 'custom'];
|
||||
|
||||
const DEFAULT_LRC_FILTERS = {
|
||||
dropCreditLines: true,
|
||||
@@ -49,6 +50,15 @@ const DEFAULT_LRC_STYLE = {
|
||||
textShadow: '0 2px 12px rgba(0, 0, 0, 0.85)',
|
||||
textShadowEnabled: true,
|
||||
animation: 'fade',
|
||||
// 入场时长(ms):模糊/缩放等动画跑得更久一些更适合直播画面
|
||||
enterDurationMs: 300,
|
||||
// 回缩:入场动画结束后,文字缓慢缩小到 holdShrinkTo 倍(1 = 不回缩)
|
||||
holdShrinkTo: 1,
|
||||
shrinkDurationMs: 0,
|
||||
blurPx: 10,
|
||||
// 出场:整段字幕结束时播放
|
||||
outro: 'fade',
|
||||
outDurationMs: 260,
|
||||
// 自定义 CSS / 自定义动画:作用于 .lrc-layer / .lrc-box / .lrc-text / .lrc-word
|
||||
customCss: '',
|
||||
showNextLine: true,
|
||||
@@ -473,6 +483,7 @@ function normalizeStyle(input) {
|
||||
if (LRC_POSITIONS.includes(src.position)) style.position = src.position;
|
||||
if (LRC_ALIGNS.includes(src.align)) style.align = src.align;
|
||||
if (LRC_ANIMATIONS.includes(src.animation)) style.animation = src.animation;
|
||||
if (LRC_OUTROS.includes(src.outro)) style.outro = src.outro;
|
||||
if (typeof src.fontFamily === 'string' && src.fontFamily.trim()) {
|
||||
style.fontFamily = cleanString(src.fontFamily, 200);
|
||||
}
|
||||
@@ -493,6 +504,11 @@ function normalizeStyle(input) {
|
||||
style.maxWidthPercent = clampNumber(src.maxWidthPercent, 20, 100, style.maxWidthPercent);
|
||||
style.nextLineScale = clampNumber(src.nextLineScale, 0.3, 1, style.nextLineScale);
|
||||
style.bottomOffsetVh = clampNumber(src.bottomOffsetVh, 0, 45, style.bottomOffsetVh);
|
||||
style.enterDurationMs = clampNumber(src.enterDurationMs, 0, 10000, style.enterDurationMs);
|
||||
style.outDurationMs = clampNumber(src.outDurationMs, 0, 10000, style.outDurationMs);
|
||||
style.shrinkDurationMs = clampNumber(src.shrinkDurationMs, 0, 20000, style.shrinkDurationMs);
|
||||
style.holdShrinkTo = clampNumber(src.holdShrinkTo, 0.3, 1, style.holdShrinkTo);
|
||||
style.blurPx = clampNumber(src.blurPx, 0, 60, style.blurPx);
|
||||
style.showNextLine = src.showNextLine !== false;
|
||||
style.backgroundEnabled = src.backgroundEnabled !== false;
|
||||
style.textShadowEnabled = src.textShadowEnabled !== false;
|
||||
@@ -542,6 +558,7 @@ module.exports = {
|
||||
LRC_POSITIONS,
|
||||
LRC_ALIGNS,
|
||||
LRC_ANIMATIONS,
|
||||
LRC_OUTROS,
|
||||
MAX_SOURCE_CHARS,
|
||||
parseLrc,
|
||||
parseTimestamp,
|
||||
|
||||
Reference in new issue
Block a user