/* LRC 字幕运行时样式:管理页预览与 OBS widget 共用 * * 状态类统一挂在 .lrc-layer 上(lrc-state-entering / hold / leaving), * 动画目标统一是 .lrc-text,两者之间隔着 .lrc-box,所以用后代选择器。 * * 时间参数由页面通过 CSS 变量注入(带兜底默认值): * --lrc-in-dur 入场时长(ms) * --lrc-out-dur 出场时长(ms) * --lrc-shrink-dur 入场结束后的缓慢回缩时长(ms) * --lrc-shrink-to 回缩后的缩放比例(1 = 不回缩) * --lrc-blur-px 模糊入场/出场时的最大模糊半径(px) */ /* ── 入场:状态类驱动,时长可调 ─────────────────────────────────────────── */ .lrc-layer.lrc-state-entering .lrc-text { animation-duration: var(--lrc-in-dur, 300ms); animation-timing-function: ease; animation-fill-mode: both; } .lrc-layer.lrc-anim-fade.lrc-state-entering .lrc-text { animation-name: lrcFadeIn; } .lrc-layer.lrc-anim-slide.lrc-state-entering .lrc-text { animation-name: lrcSlideIn; animation-timing-function: cubic-bezier(0.2, 0.8, 0.3, 1); } .lrc-layer.lrc-anim-zoom.lrc-state-entering .lrc-text { animation-name: lrcZoomIn; animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1.15); } .lrc-layer.lrc-anim-blur.lrc-state-entering .lrc-text { animation-name: lrcBlurIn; } .lrc-layer.lrc-anim-bounce.lrc-state-entering .lrc-text { animation-name: lrcBounceIn; animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1.2); } /* lrc-anim-custom:不内置动画,由「自定义 CSS」定义,例如: .lrc-layer.lrc-anim-custom.lrc-state-entering .lrc-text { animation: myAnim .5s ease both; } @keyframes myAnim { from { opacity: 0; transform: translateY(18px) scale(.96); } } */ .lrc-layer.lrc-anim-none.lrc-state-entering .lrc-text, .lrc-layer.lrc-anim-custom.lrc-state-entering .lrc-text { animation-name: none; } /* 入场结束后:缓慢回缩(scale 走 transform,不干扰逐字的颜色/发光) */ .lrc-layer.lrc-state-hold .lrc-text { transform: scale(var(--lrc-shrink-to, 1)); transform-origin: center; transition: transform var(--lrc-shrink-dur, 0ms) linear; } /* ── 出场 ───────────────────────────────────────────────────────────────── */ .lrc-layer.lrc-state-leaving .lrc-text { animation-duration: var(--lrc-out-dur, 260ms); animation-timing-function: ease; animation-fill-mode: both; } .lrc-layer.lrc-out-fade.lrc-state-leaving .lrc-text { animation-name: lrcOutFade; } .lrc-layer.lrc-out-slideDown.lrc-state-leaving .lrc-text { animation-name: lrcOutSlideDown; animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); } .lrc-layer.lrc-out-slideUp.lrc-state-leaving .lrc-text { animation-name: lrcOutSlideUp; animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1); } .lrc-layer.lrc-out-zoom.lrc-state-leaving .lrc-text { animation-name: lrcOutZoom; } .lrc-layer.lrc-out-blur.lrc-state-leaving .lrc-text { animation-name: lrcOutBlur; } /* lrc-out-custom:由「自定义 CSS」定义出场动画 */ .lrc-layer.lrc-out-none.lrc-state-leaving .lrc-text, .lrc-layer.lrc-out-custom.lrc-state-leaving .lrc-text { animation-name: none; } /* ── 关键帧 ─────────────────────────────────────────────────────────────── */ @keyframes lrcFadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes lrcSlideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } } @keyframes lrcZoomIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } } @keyframes lrcBlurIn { 0% { opacity: 0; filter: blur(var(--lrc-blur-px, 10px)); } 30% { opacity: 0.32; } 45% { opacity: 0.55; filter: blur(calc(var(--lrc-blur-px, 10px) * 0.55)); } 100% { opacity: 1; filter: blur(0px); } } @keyframes lrcBounceIn { 0% { opacity: 0; transform: translateY(22px) scale(0.94); } 55% { opacity: 1; transform: translateY(-4px) scale(1.02); } 100% { opacity: 1; transform: translateY(0) scale(1); } } @keyframes lrcOutFade { from { opacity: 1; } to { opacity: 0; } } @keyframes lrcOutSlideDown { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(14px); } } @keyframes lrcOutSlideUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-12px); } } @keyframes lrcOutZoom { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.92); } } @keyframes lrcOutBlur { 0% { opacity: 1; filter: blur(0px); } /* 一开始就快速起糊,避免前段看起来「没动静」 */ 25% { opacity: 0.92; filter: blur(calc(var(--lrc-blur-px, 10px) * 0.35)); } 60% { opacity: 0.55; filter: blur(calc(var(--lrc-blur-px, 10px) * 0.72)); } 100% { opacity: 0; filter: blur(var(--lrc-blur-px, 10px)); } } /* 系统开启「减少动态效果」时收窄过渡,避免不适 */ @media (prefers-reduced-motion: reduce) { .lrc-layer.lrc-state-hold .lrc-text { transition-duration: 1ms; } } /* ── 逐字(增强型 LRC) ─────────────────────────────────────────────────── */ .lrc-text .lrc-word { color: var(--lrc-karaoke-pending, rgba(255, 255, 255, 0.45)); transition: color 0.12s linear, text-shadow 0.12s linear, opacity 0.12s linear; } .lrc-text .lrc-word.is-sung { color: var(--lrc-color, #ffffff); } /* .is-current 是当前正在唱的字,可被自定义 CSS 用来做发光/放大等修饰 */ .lrc-text .lrc-word.is-current { /* 默认与已唱字一致,仅作为自定义钩子 */ }