@applemusic-like-lyrics/core 0.0.1 → 0.0.2
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/README.md +24 -1
- package/dist/amll-core.js +2 -1
- package/dist/amll-core.js.map +1 -0
- package/dist/amll-core.mjs +452 -236
- package/dist/amll-core.mjs.map +1 -0
- package/dist/bg-render/pixi-renderer.d.ts +29 -2
- package/dist/index.d.ts +3 -0
- package/dist/lyric-player/index.d.ts +69 -6
- package/dist/lyric-player/lyric-line.d.ts +2 -0
- package/package.json +16 -1
package/README.md
CHANGED
|
@@ -4,4 +4,27 @@ AMLL 的纯 JS 核心组件框架,包括歌词显示组件和背景组件等
|
|
|
4
4
|
|
|
5
5
|
此处的东西都是 UI 框架无关的,所以可以间接在各种动态页面框架下引用。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
或者如果你需要使用组件绑定的话,这里有 [React 绑定版本](../react/README.md) 和 [Vue 绑定版本](../vue/README.md)
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @applemusic-like-lyrics/core # 使用 npm
|
|
13
|
+
yarn add @applemusic-like-lyrics/core # 使用 yarn
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 使用方式摘要
|
|
17
|
+
|
|
18
|
+
详细的 API 文档请参考 [./docs/modules.md](./docs/modules.md)
|
|
19
|
+
|
|
20
|
+
一个测试用途的程序可以在 [./src/test.ts](./src/test.ts) 里找到。
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { LyricPlayer } from "@applemusic-like-lyrics/core";
|
|
24
|
+
|
|
25
|
+
const player = new LyricPlayer(); // 创建歌词播放组件
|
|
26
|
+
document.body.appendChild(player.getElement()); // 将组件的元素添加到页面
|
|
27
|
+
player.setLyricLines([]) // 设置歌词
|
|
28
|
+
player.setCurrentTime(0) // 设定当前播放时间(需要逐帧调用)
|
|
29
|
+
player.update(0) // 更新歌词组件动画(需要逐帧调用)
|
|
30
|
+
```
|
package/dist/amll-core.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var v=(d,t,e)=>t in d?w(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var l=(d,t,e)=>(v(d,typeof t!="symbol"?t+"":t,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("@pixi/display"),C=require("@pixi/app"),f=require("@pixi/filter-blur"),b=require("@pixi/filter-color-matrix"),M=require("@pixi/core"),L=require("@pixi/sprite"),z=require("jss"),B=require("jss-preset-default");class I extends x.Container{constructor(){super(...arguments);l(this,"time",0)}}class A{constructor(t){l(this,"observer");l(this,"app");l(this,"curContainer");l(this,"lastContainer",new Set);l(this,"onTick",t=>{for(const e of this.lastContainer)e.alpha=Math.max(0,e.alpha-t/60),e.alpha<=0&&(this.app.stage.removeChild(e),this.lastContainer.delete(e));if(this.curContainer){this.curContainer.alpha=Math.min(1,this.curContainer.alpha+t/60);const[e,r,s,a]=this.curContainer.children,h=Math.max(this.app.screen.width,this.app.screen.height);e.position.set(this.app.screen.width/2,this.app.screen.height/2),r.position.set(this.app.screen.width/2.5,this.app.screen.height/2.5),s.position.set(this.app.screen.width/2,this.app.screen.height/2),a.position.set(this.app.screen.width/2,this.app.screen.height/2),e.width=h*Math.sqrt(2),e.height=e.width,r.width=h*.8,r.height=r.width,s.width=h*.5,s.height=s.width,a.width=h*.25,a.height=a.width,this.curContainer.time+=t*this.flowSpeed,e.rotation+=t/1e3*this.flowSpeed,r.rotation-=t/500*this.flowSpeed,s.rotation+=t/1e3*this.flowSpeed,a.rotation-=t/750*this.flowSpeed,s.x=this.app.screen.width/2+this.app.screen.width/4*Math.cos(this.curContainer.time/1e3*.75),s.y=this.app.screen.height/2+this.app.screen.width/4*Math.cos(this.curContainer.time/1e3*.75),a.x=this.app.screen.width/2+this.app.screen.width/4*.1+Math.cos(this.curContainer.time*.006*.75),a.y=this.app.screen.height/2+this.app.screen.width/4*.1+Math.cos(this.curContainer.time*.006*.75)}});l(this,"flowSpeed",2);l(this,"currerntRenderScale",.75);this.canvas=t;const e=t.getBoundingClientRect();this.canvas.width=e.width*this.currerntRenderScale,this.canvas.height=e.height*this.currerntRenderScale,this.observer=new ResizeObserver(()=>{const r=t.getBoundingClientRect();this.canvas.width=Math.max(1,r.width),this.canvas.height=Math.max(1,r.height),this.app.renderer.resize(this.canvas.width*this.currerntRenderScale,this.canvas.height*this.currerntRenderScale),this.rebuildFilters()}),this.observer.observe(t),this.app=new C.Application({view:t,resizeTo:this.canvas,powerPreference:"low-power",backgroundAlpha:0}),this.rebuildFilters(),this.app.ticker.add(this.onTick),this.app.ticker.start()}setRenderScale(t){this.currerntRenderScale=t;const e=this.canvas.getBoundingClientRect();this.canvas.width=Math.max(1,e.width),this.canvas.height=Math.max(1,e.height),this.app.renderer.resize(this.canvas.width*this.currerntRenderScale,this.canvas.height*this.currerntRenderScale),this.rebuildFilters()}rebuildFilters(){const t=Math.min(this.canvas.width,this.canvas.height),e=new b.ColorMatrixFilter;e.saturate(1.2,!1);const r=new b.ColorMatrixFilter;r.brightness(.6,!1);const s=new b.ColorMatrixFilter;s.contrast(.3,!0),this.app.stage.filters=[],this.app.stage.filters.push(new f.BlurFilter(5,1)),this.app.stage.filters.push(new f.BlurFilter(10,1)),this.app.stage.filters.push(new f.BlurFilter(20,2)),this.app.stage.filters.push(new f.BlurFilter(40,2)),t>512&&this.app.stage.filters.push(new f.BlurFilter(80,2)),t>768&&this.app.stage.filters.push(new f.BlurFilter(160,4)),t>768*2&&this.app.stage.filters.push(new f.BlurFilter(320,4)),this.app.stage.filters.push(e,r,s),this.app.stage.filters.push(new f.BlurFilter(5,1))}setFPS(t){this.app.ticker.maxFPS=t}pause(){this.app.ticker.stop(),this.app.render()}resume(){this.app.ticker.start()}async setAlbumImage(t){const e=await M.Texture.fromURL(t),r=new I,s=new L.Sprite(e),a=new L.Sprite(e),h=new L.Sprite(e),i=new L.Sprite(e);s.anchor.set(.5,.5),a.anchor.set(.5,.5),h.anchor.set(.5,.5),i.anchor.set(.5,.5),s.rotation=Math.random()*Math.PI*2,a.rotation=Math.random()*Math.PI*2,h.rotation=Math.random()*Math.PI*2,i.rotation=Math.random()*Math.PI*2,r.addChild(s,a,h,i),this.curContainer&&this.lastContainer.add(this.curContainer),this.curContainer=r,this.app.stage.addChild(this.curContainer),this.curContainer.alpha=0}dispose(){this.observer.disconnect(),this.app.ticker.remove(this.onTick)}}class D extends A{constructor(){const e=document.createElement("canvas");super(e);l(this,"element");this.element=e,e.style.pointerEvents="none",e.style.zIndex="-1"}getElement(){return this.element}dispose(){super.dispose(),this.element.remove()}}const k=(d,t)=>d.size===t.size&&[...d].every(e=>t.has(e));function q(d){const e=2.5949095;return d<.5?Math.pow(2*d,2)*((e+1)*2*d-e)/2:(Math.pow(2*d-2,2)*((e+1)*(d*2-2)+e)+2)/2}const y=(d,t,e)=>Math.max(d,Math.min(t,e));class F{constructor(t){l(this,"element",document.createElement("div"));l(this,"dot0",document.createElement("span"));l(this,"dot1",document.createElement("span"));l(this,"dot2",document.createElement("span"));l(this,"left",0);l(this,"top",0);l(this,"scale",1);l(this,"lastStyle","");l(this,"currentInterlude");l(this,"currentTime",0);l(this,"targetBreatheDuration",1500);this.lyricPlayer=t,this.element.className=this.lyricPlayer.style.classes.interludeDots,this.element.appendChild(this.dot0),this.element.appendChild(this.dot1),this.element.appendChild(this.dot2)}getElement(){return this.element}setTransform(t=this.left,e=this.top){this.left=t,this.top=e,this.update()}setInterlude(t){this.currentInterlude=t,this.currentTime=(t==null?void 0:t[0])??0}update(t=0){this.currentTime+=t;let e="";if(e+=`transform:translate(${this.left}px, ${this.top}px)`,this.currentInterlude){const r=this.currentInterlude[1]-this.currentInterlude[0],s=this.currentTime-this.currentInterlude[0];if(s<=r){const a=r/Math.ceil(r/this.targetBreatheDuration);let h=1,i=1;h*=Math.sin(1.5*Math.PI-s/a*2)/10+1,s<1e3&&(h*=1-Math.pow((1e3-s)/1e3,2)),s<500?i=0:s<1e3&&(i*=(s-500)/500),r-s<750&&(h*=1-q((750-(r-s))/750/2)),r-s<375&&(i*=y(0,(r-s)/375,1)),h=Math.max(0,h),e+=` scale(${h})`;const n=y(.25,s*3/r*.75,1),c=y(.25,(s-r/3)*3/r*.75,1),o=y(.25,(s-r/3*2)*3/r*.75,1);this.dot0.style.opacity=`${y(0,Math.max(0,i*n),1)}`,this.dot1.style.opacity=`${y(0,Math.max(0,i*c),1)}`,this.dot2.style.opacity=`${y(0,Math.max(0,i*o),1)}`}else e+=" scale(0)",this.dot0.style.opacity="0",this.dot1.style.opacity="0",this.dot2.style.opacity="0"}else e+=" scale(0)",this.dot0.style.opacity="0",this.dot1.style.opacity="0",this.dot2.style.opacity="0";e+=";",this.lastStyle!==e&&(this.element.setAttribute("style",e),this.lastStyle=e)}dispose(){this.element.remove()}}class S{constructor(t=0){l(this,"currentPosition",0);l(this,"targetPosition",0);l(this,"currentTime",0);l(this,"params",{});l(this,"currentSolver");l(this,"getV");l(this,"queueParams");l(this,"queuePosition");this.targetPosition=t,this.currentPosition=this.targetPosition,this.currentSolver=()=>this.targetPosition,this.getV=()=>0}resetSolver(){const t=this.getV(this.currentTime);this.currentTime=0,this.currentSolver=$(this.currentPosition,t,this.targetPosition,0,this.params),this.getV=O(this.currentSolver)}arrived(){return Math.abs(this.targetPosition-this.currentPosition)<.01&&this.getV(this.currentTime)<.01&&this.queueParams===void 0&&this.queuePosition===void 0}setPosition(t){this.targetPosition=t,this.currentPosition=t,this.currentSolver=()=>this.targetPosition,this.getV=()=>0}update(t=0){this.currentTime+=t,this.currentPosition=this.currentSolver(this.currentTime),this.queueParams&&(this.queueParams.time-=t,this.queueParams.time<=0&&this.updateParams({...this.queueParams})),this.queuePosition&&(this.queuePosition.time-=t,this.queuePosition.time<=0&&this.setTargetPosition(this.queuePosition.position)),this.arrived()&&this.setPosition(this.targetPosition)}updateParams(t,e=0){e>0?this.queueParams={...t,time:e}:(this.params={...this.params,...t},this.resetSolver())}setTargetPosition(t,e=0){e>0?this.queuePosition={position:t,time:e}:(this.queuePosition=void 0,this.targetPosition=t,this.resetSolver())}getCurrentPosition(){return this.currentPosition}}function $(d,t,e,r=0,s){const a=(s==null?void 0:s.soft)??!1,h=(s==null?void 0:s.stiffness)??100,i=(s==null?void 0:s.damping)??10,n=(s==null?void 0:s.mass)??1,c=e-d;if(a||1<=i/(2*Math.sqrt(h*n))){const o=-Math.sqrt(h/n),m=-o*c-t;return p=>(p-=r,p<0?d:e-(c+p*m)*Math.E**(p*o))}else{const o=Math.sqrt(4*n*h-i**2),m=(i*c-2*n*t)/o,p=.5*o/n,g=-(.5*i)/n;return u=>(u-=r,u<0?d:e-(Math.cos(u*p)*c+Math.sin(u*p)*m)*Math.E**(u*g))}}function R(d){return e=>(d(e+.001)-d(e-.001))/(2*.001)}function O(d){return R(d)}const T=/^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u;function W(d,t="rgba(0,0,0,1)",e="rgba(0,0,0,0.5)"){const r=2+d,s=d/r,a=(1-s)/2;return[`linear-gradient(to right,${t} ${a*100}%,${e} ${(a+s)*100}%)`,s,r]}function P(d){return d.endTime-d.startTime>=1e3&&d.word.length<=7}class G{constructor(t,e={words:[],translatedLyric:"",romanLyric:"",startTime:0,endTime:0,isBG:!1,isDuet:!1}){l(this,"element",document.createElement("div"));l(this,"left",0);l(this,"top",0);l(this,"scale",1);l(this,"blur",0);l(this,"delay",0);l(this,"splittedWords",[]);l(this,"lineSize",[0,0]);l(this,"lineTransforms",{posX:new S(0),posY:new S(0),scale:new S(1)});l(this,"_hide",!0);l(this,"lastStyle","");this.lyricPlayer=t,this.lyricLine=e,this.element.setAttribute("class",this.lyricPlayer.style.classes.lyricLine),this.lyricLine.isBG&&this.element.classList.add(this.lyricPlayer.style.classes.lyricBgLine),this.lyricLine.isDuet&&this.element.classList.add(this.lyricPlayer.style.classes.lyricDuetLine),this.element.appendChild(document.createElement("div")),this.element.appendChild(document.createElement("div")),this.element.appendChild(document.createElement("div"));const r=this.element.children[0],s=this.element.children[1],a=this.element.children[2];r.setAttribute("class",this.lyricPlayer.style.classes.lyricMainLine),s.setAttribute("class",this.lyricPlayer.style.classes.lyricSubLine),a.setAttribute("class",this.lyricPlayer.style.classes.lyricSubLine),this.rebuildElement(),this.rebuildStyle()}enable(){this.element.classList.add("active");const t=this.element.children[0];this.splittedWords.forEach(e=>{e.elementAnimations.forEach(r=>{r.currentTime=0,r.playbackRate=1,r.play()})}),t.classList.add("active")}disable(){this.element.classList.remove("active");const t=this.element.children[0];this.splittedWords.forEach(e=>{e.elementAnimations.forEach(r=>{r.id==="float-word"&&(r.playbackRate=-1,r.play())})}),t.classList.remove("active")}setLine(t){this.lyricLine=t,this.lyricLine.isBG?this.element.classList.add(this.lyricPlayer.style.classes.lyricBgLine):this.element.classList.remove(this.lyricPlayer.style.classes.lyricBgLine),this.lyricLine.isDuet?this.element.classList.add(this.lyricPlayer.style.classes.lyricDuetLine):this.element.classList.remove(this.lyricPlayer.style.classes.lyricDuetLine),this.rebuildElement(),this.rebuildStyle()}getLine(){return this.lyricLine}show(){this._hide=!1,this.rebuildStyle()}hide(){this._hide=!0,this.rebuildStyle()}rebuildStyle(){if(this._hide){this.lastStyle!=="visibility:hidden;transform:translate(0,-10000px);"&&(this.lastStyle="visibility:hidden;transform:translate(0,-10000px);",this.element.setAttribute("style","visibility:hidden;transform:translate(0,-10000px);"));return}let t=`transform:translate(${this.lineTransforms.posX.getCurrentPosition()}px,${this.lineTransforms.posY.getCurrentPosition()}px) scale(${this.lineTransforms.scale.getCurrentPosition()});`;this.lyricPlayer.disableSpring&&this.isInSight&&(t+=`transition-delay:${this.delay}ms;`),t+=`filter:blur(${Math.min(32,this.blur)}px);`,t!==this.lastStyle&&(this.lastStyle=t,this.element.setAttribute("style",t))}rebuildElement(){const t=this.element.children[0],e=this.element.children[1],r=this.element.children[2];this.splittedWords=[],this.lyricLine.words.forEach(n=>{if(T.test(n.word))this.splittedWords.push({...n,width:0,height:0,elements:[],elementAnimations:[],shouldEmphasize:P(n)});else{const c=/(\s*)(\S*)(\s*)/.exec(n.word);c&&(c[1].length>0&&this.splittedWords.push({word:" ",startTime:0,endTime:0,width:0,height:0,elements:[],elementAnimations:[],shouldEmphasize:!1}),this.splittedWords.push({word:c[2],startTime:n.startTime,endTime:n.endTime,width:0,height:0,elements:[],elementAnimations:[],shouldEmphasize:P(n)}),c[3].length>0&&this.splittedWords.push({word:" ",startTime:0,endTime:0,width:0,height:0,elements:[],elementAnimations:[],shouldEmphasize:!1}))}});const s=[],a=[];function h(n){for(;n.firstChild;)n.firstChild.nodeType===Node.ELEMENT_NODE?s.push(t.firstChild):n.firstChild.nodeType===Node.TEXT_NODE&&a.push(t.firstChild),n.removeChild(n.firstChild),h(n.firstChild)}h(t);let i=null;this.splittedWords.forEach(n=>{if(n.word.trim().length>0)if(n.shouldEmphasize){const c=s.pop()??document.createElement("span");c.className="emphasize",n.elements=[c];for(const o of n.word){const m=s.pop()??document.createElement("span");m.className="",m.innerText=o,c.appendChild(m),n.elements.push(m)}if(n.elementAnimations=this.initEmphasizeAnimation(n),console.log(n.word,T.test(n.word)),i&&!T.test(n.word))if(i.childElementCount>0)i.appendChild(c);else{const o=s.pop()??document.createElement("span");o.className="",i.remove(),o.appendChild(i),o.appendChild(c),t.appendChild(o),i=o}else i=T.test(n.word)?null:c,t.appendChild(c)}else{const c=s.pop()??document.createElement("span");if(c.className="",c.innerText=n.word,n.elements=[c],n.elementAnimations.push(this.initFloatAnimation(n,c)),i)if(i.childElementCount>0)i.appendChild(c);else{const o=s.pop()??document.createElement("span");o.className="",i.remove(),o.appendChild(i),o.appendChild(c),t.appendChild(o),i=o}else i=c,t.appendChild(c)}else if(n.word.length>0){const c=a.pop()??document.createTextNode(" ");t.appendChild(c),i=null}else i=null}),e.innerText=this.lyricLine.translatedLyric,r.innerText=this.lyricLine.romanLyric}initFloatAnimation(t,e){const r=e.animate([{transform:"translateY(0px)"},{transform:"translateY(-3%)"}],{duration:Math.max(1e3,t.endTime-t.startTime),delay:t.startTime-this.lyricLine.startTime,id:"float-word",composite:"add",fill:"both"});return r.pause(),r}initEmphasizeAnimation(t){const e=t.startTime-this.lyricLine.startTime,r=t.endTime-t.startTime;return t.elements.map((s,a,h)=>{if(a===0)return this.initFloatAnimation(t,s);{const i=s.animate([{offset:0,transform:"translate3d(0, 0px, 0px)",filter:"drop-shadow(0 0 0 var(--amll-lyric-line-color))"},{offset:.5,transform:"translate3d(0, -2%, 20px)",filter:"drop-shadow(0 0 0.2rem var(--amll-lyric-line-color))"},{offset:1,transform:"translate3d(0, 0px, 0)",filter:"drop-shadow(0 0 0 var(--amll-lyric-line-color))"}],{duration:Math.max(1e3,t.endTime-t.startTime),delay:e+r/(h.length-1)*(a-1),id:"glow-word",iterations:1,composite:"replace",fill:"both"});return i.pause(),i}})}updateMaskImage(){this.splittedWords.forEach(t=>{const e=t.elements[0];if(e){t.width=e.clientWidth,t.height=e.clientHeight;const[r,s,a]=W(16/t.width,"rgba(0,0,0,0.75)","rgba(0,0,0,0.25)"),h=`${a*100}% 100%`;this.lyricPlayer.supportMaskImage?(e.style.maskImage=r,e.style.maskOrigin="left",e.style.maskSize=h):(e.style.webkitMaskImage=r,e.style.webkitMaskOrigin="left",e.style.webkitMaskSize=h);const i=t.width+16,n=`clamp(${-i}px,calc(${-i}px + (var(--amll-player-time) - ${t.startTime})*${i/Math.abs(t.endTime-t.startTime)}px),0px) 0px, left top`;e.style.maskPosition=n,e.style.webkitMaskPosition=n}})}getElement(){return this.element}setTransform(t=this.left,e=this.top,r=this.scale,s=1,a=0,h=!1,i=0){this.left=t,this.top=e,this.scale=r,this.delay=i*1e3|0;const n=this.element.children[0];n.style.opacity=`${s}`,h||this.lyricPlayer.disableSpring?(this.blur=Math.min(32,a),h&&this.element.classList.add(this.lyricPlayer.style.classes.tmpDisableTransition),this.lineTransforms.posX.setPosition(t),this.lineTransforms.posY.setPosition(e),this.lineTransforms.scale.setPosition(r),this.lyricPlayer.disableSpring?this.show():this.rebuildStyle(),h&&requestAnimationFrame(()=>{this.element.classList.remove(this.lyricPlayer.style.classes.tmpDisableTransition)})):(this.lineTransforms.posX.setTargetPosition(t,i),this.lineTransforms.posY.setTargetPosition(e,i),this.lineTransforms.scale.setTargetPosition(r),this.blur!==Math.min(32,a)&&(this.blur=Math.min(32,a),this.element.style.filter=`blur(${Math.min(32,a)}px)`))}update(t=0){this.lyricPlayer.disableSpring||(this.lineTransforms.posX.update(t),this.lineTransforms.posY.update(t),this.lineTransforms.scale.update(t),this.isInSight?this.show():this.hide())}get isInSight(){const t=this.lineTransforms.posX.getCurrentPosition(),e=this.lineTransforms.posY.getCurrentPosition(),r=t+this.lineSize[0],s=e+this.lineSize[1],a=this.lyricPlayer.pos[0],h=this.lyricPlayer.pos[1],i=this.lyricPlayer.pos[0]+this.lyricPlayer.size[0],n=this.lyricPlayer.pos[1]+this.lyricPlayer.size[1];return!(t>i||e>n||r<a||s<h)}dispose(){this.element.remove()}}const X=z.create(B());class Y extends EventTarget{constructor(){super();l(this,"element",document.createElement("div"));l(this,"currentTime",0);l(this,"lyricLines",[]);l(this,"processedLines",[]);l(this,"lyricLinesEl",[]);l(this,"lyricLinesSize",new Map);l(this,"hotLines",new Set);l(this,"bufferedLines",new Set);l(this,"scrollToIndex",0);l(this,"resizeObserver",new ResizeObserver(e=>{const r=e[0].contentRect;this.size[0]=r.width,this.size[1]=r.height,this.pos[0]=r.left,this.pos[1]=r.top,this.rebuildStyle(),this.calcLayout(!0),this.lyricLinesEl.forEach(s=>s.updateMaskImage())}));l(this,"posXSpringParams",{mass:1,damping:10,stiffness:100});l(this,"posYSpringParams",{mass:1,damping:15,stiffness:100});l(this,"scaleSpringParams",{mass:1,damping:20,stiffness:100});l(this,"enableBlur",!0);l(this,"interludeDots");l(this,"interludeDotsSize",[0,0]);l(this,"supportPlusLighter",CSS.supports("mix-blend-mode","plus-lighter"));l(this,"supportMaskImage",CSS.supports("mask-image","none"));l(this,"disableSpring",!1);l(this,"alignAnchor",.5);l(this,"size",[0,0]);l(this,"pos",[0,0]);l(this,"style",X.createStyleSheet({lyricPlayer:{userSelect:"none",padding:"1rem",boxSizing:"border-box",fontSize:"max(5vh, 12px)",fontWeight:"bold",width:"100%",height:"100%",overflow:"hidden",maxWidth:"100%",maxHeight:"100%",zIndex:1,color:"var(--amll-lyric-line-color)",mixBlendMode:"plus-lighter",contain:"strict"},lyricLine:{position:"absolute",transformOrigin:"left",maxWidth:"65%",padding:"max(2vh, 1rem) 1rem",contain:"content",transition:"filter 0.25s",margin:"max(2vh, 1rem) -1rem"},"@media (max-width: 1024px)":{lyricLine:{maxWidth:"75%",padding:"max(1vh, 1rem) 1rem",margin:"0 -1rem"}},lyricDuetLine:{textAlign:"right",transformOrigin:"right"},lyricBgLine:{opacity:0,fontSize:"max(50%, 10px)",transition:"opacity 0.25s","&.active":{transition:"opacity 0.25s 0.25s",opacity:1}},lyricMainLine:{transition:"opacity 0.3s 0.25s",margin:"-1rem",padding:"1rem","& span":{display:"inline-block",margin:"-1rem",padding:"1rem"},"& > span":{whiteSpace:"pre-wrap",wordBreak:"keep-all",maxLines:"1","&.emphasize":{margin:"-1rem",padding:"1rem",transformStyle:"preserve-3d",perspective:"50vw"}}},lyricSubLine:{fontSize:"max(50%, 10px)",opacity:.5},disableSpring:{"& > *":{transition:"filter 0.25s, transform 0.5s"}},interludeDots:{height:"min(1rem,2.5vh)",transformOrigin:"center",width:"fit-content",padding:"2.5% 0",position:"absolute",display:"flex",gap:"0.5rem","& > *":{width:"100%",display:"inline-block",borderRadius:"50%",aspectRatio:"1 / 1",backgroundColor:"var(--amll-lyric-line-color)",marginRight:"4px"},"&.duet":{right:"1rem",transformOrigin:"center"}},"@supports (mix-blend-mode: plus-lighter)":{lyricSubLine:{opacity:.3}},tmpDisableTransition:{transition:"none !important"}}));l(this,"onPageShow",()=>{this.calcLayout(!0)});this.interludeDots=new F(this),this.element.setAttribute("class",this.style.classes.lyricPlayer),this.disableSpring&&this.element.classList.add(this.style.classes.disableSpring),this.rebuildStyle(),this.resizeObserver.observe(this.element),this.element.appendChild(this.interludeDots.getElement()),this.style.attach(),this.interludeDots.setTransform(0,200),window.addEventListener("pageshow",this.onPageShow)}setEnableSpring(e=!0){this.disableSpring=!e,e?this.element.classList.remove(this.style.classes.disableSpring):this.element.classList.add(this.style.classes.disableSpring),this.calcLayout(!0)}getCurrentInterlude(){var s,a,h;if(this.bufferedLines.size>0)return;const e=this.currentTime+20,r=this.scrollToIndex;if(r===0){if((s=this.processedLines[0])!=null&&s.startTime&&this.processedLines[0].startTime>e)return[0,this.processedLines[0].startTime]}else if((a=this.processedLines[r])!=null&&a.endTime&&((h=this.processedLines[r+1])!=null&&h.startTime)&&this.processedLines[r+1].startTime>e&&this.processedLines[r].endTime<e)return[this.processedLines[r].endTime,this.processedLines[r+1].startTime]}rebuildStyle(){let e="";e+="--amll-lyric-player-width:",e+=this.element.clientWidth,e+="px;",e+="--amll-lyric-player-height:",e+=this.element.clientHeight,e+="px;",e+="--amll-lyric-line-color:",e+="#FFFFFF;",e+="--amll-player-time:",e+=this.currentTime,e+=";",this.element.setAttribute("style",e)}setEnableBlur(e){this.enableBlur!==e&&(this.enableBlur=e,this.calcLayout())}setLyricLines(e){this.lyricLines=e;const r=750;this.processedLines=e.map((s,a,h)=>{if(s.isBG)return{...s};{const i=h[a-1],n=h[a-2];if(i!=null&&i.isBG&&n){if(n.endTime<s.startTime)return{...s,startTime:Math.max(n.endTime,s.startTime-r)||s.startTime}}else if(i!=null&&i.endTime&&i.endTime<s.startTime)return{...s,startTime:Math.max(i==null?void 0:i.endTime,s.startTime-r)||s.startTime};return{...s}}}),this.processedLines.forEach((s,a,h)=>{const i=h[a+1],n=s.words[s.words.length-1];n&&P(n)&&(i?i.startTime>s.endTime&&(s.endTime=Math.min(s.endTime+1500,i.startTime)):s.endTime=s.endTime+1500)}),this.processedLines.forEach((s,a,h)=>{if(s.isBG)return;const i=h[a+1];i!=null&&i.isBG&&(i.startTime=Math.min(i.startTime,s.startTime))}),this.lyricLinesEl.forEach(s=>s.dispose()),this.lyricLinesEl=this.processedLines.map(s=>new G(this,s)),this.lyricLinesEl.forEach(s=>(this.element.appendChild(s.getElement()),s.updateMaskImage())),this.setLinePosXSpringParams({}),this.setLinePosYSpringParams({}),this.setLineScaleSpringParams({}),this.setCurrentTime(0,!0),this.calcLayout(!0)}calcLayout(e=!1){e&&(this.lyricLinesEl.forEach(o=>{const m=[o.getElement().clientWidth,o.getElement().clientHeight];this.lyricLinesSize.set(o,m),o.lineSize=m}),this.interludeDotsSize[0]=this.interludeDots.getElement().clientWidth,this.interludeDotsSize[1]=this.interludeDots.getElement().clientHeight);const r=.95;let a=-this.lyricLinesEl.slice(0,this.scrollToIndex).reduce((o,m)=>o+(m.getLine().isBG?0:this.lyricLinesSize.get(m)[1]),0);if(this.alignAnchor==="bottom"){a+=this.element.clientHeight/2;const o=this.lyricLinesEl[this.scrollToIndex];if(o){const m=this.lyricLinesSize.get(o)[1];a-=m/2}}else if(typeof this.alignAnchor=="number"){a+=this.element.clientHeight*this.alignAnchor;const o=this.lyricLinesEl[this.scrollToIndex];if(o){const m=this.lyricLinesSize.get(o)[1];a-=m/2}}const h=this.currentTime===0?void 0:this.getCurrentInterlude();let i=0;if(h&&(i=h[1]-h[0],i>=5e3)){const o=this.currentTime===0?this.lyricLinesEl[0]:this.lyricLinesEl[this.scrollToIndex+1];o&&(a-=this.lyricLinesSize.get(o)[1])}const n=Math.max(...this.bufferedLines);let c=0;this.lyricLinesEl.forEach((o,m)=>{const p=this.bufferedLines.has(m),g=p||m>=this.scrollToIndex&&m<n,u=o.getLine();let E=0;u.isDuet&&(E=this.size[0]-this.lyricLinesSize.get(o)[0]),m===this.scrollToIndex+1&&i>=5e3&&(this.interludeDots.setTransform(0,a),this.interludeDots.setInterlude(this.getCurrentInterlude()),a+=this.interludeDotsSize[1]),o.setTransform(E,a,g?1:r,p?1:1/3,this.enableBlur?3*(g?0:1+(m<this.scrollToIndex?Math.abs(this.scrollToIndex-m):Math.abs(m-Math.max(this.scrollToIndex,n)))):0,e,c),u.isBG&&g?a+=this.lyricLinesSize.get(o)[1]:u.isBG||(a+=this.lyricLinesSize.get(o)[1]),a>=0&&(c+=.05)})}getCurrentTime(){return this.currentTime}getLyrics(){return this.lyricLines}getElement(){return this.element}setCurrentTime(e,r=!1){this.currentTime=e,this.element.style.setProperty("--amll-player-time",`${e}`);const s=new Set,a=new Set,h=new Set;this.hotLines.forEach(i=>{const n=this.processedLines[i];if(!n.isBG)if(n){const c=this.processedLines[i+1];if(c!=null&&c.isBG){const o=Math.min(n.startTime,c==null?void 0:c.startTime),m=Math.max(n.endTime,c==null?void 0:c.endTime);(o>e||m<=e)&&(this.hotLines.delete(i),s.add(i),this.hotLines.delete(i+1),s.add(i+1),r&&(this.lyricLinesEl[i].disable(),this.lyricLinesEl[i+1].disable()))}else(n.startTime>e||n.endTime<=e)&&(this.hotLines.delete(i),s.add(i),r&&this.lyricLinesEl[i].disable())}else this.hotLines.delete(i),s.add(i),r&&this.lyricLinesEl[i].disable()}),this.processedLines.forEach((i,n,c)=>{var o;!i.isBG&&i.startTime<=e&&i.endTime>e&&(this.hotLines.has(n)||(this.hotLines.add(n),h.add(n),r&&this.lyricLinesEl[n].enable(),(o=c[n+1])!=null&&o.isBG&&(this.hotLines.add(n+1),h.add(n+1),r&&this.lyricLinesEl[n+1].enable())))}),this.bufferedLines.forEach(i=>{this.hotLines.has(i)||(a.add(i),r&&this.lyricLinesEl[i].disable())}),r?(this.bufferedLines.size>0?this.scrollToIndex=Math.min(...this.bufferedLines):this.scrollToIndex=this.processedLines.findIndex(i=>i.startTime>=e),this.bufferedLines.clear(),this.hotLines.forEach(i=>this.bufferedLines.add(i)),this.calcLayout(!0)):(a.size>0||h.size>0)&&(a.size===0&&h.size>0?(h.forEach(i=>{this.bufferedLines.add(i),this.lyricLinesEl[i].enable()}),this.scrollToIndex=Math.min(...this.bufferedLines)):h.size===0&&a.size>0?k(a,this.bufferedLines)&&this.bufferedLines.forEach(i=>{this.hotLines.has(i)||(this.bufferedLines.delete(i),this.lyricLinesEl[i].disable())}):(h.forEach(i=>{this.bufferedLines.add(i),this.lyricLinesEl[i].enable()}),a.forEach(i=>{this.bufferedLines.delete(i),this.lyricLinesEl[i].disable()}),this.bufferedLines.size>0&&(this.scrollToIndex=Math.min(...this.bufferedLines))),this.calcLayout())}update(e=0){const r=e/1e3;this.interludeDots.update(e),this.lyricLinesEl.forEach(s=>s.update(r))}setLinePosXSpringParams(e){this.posXSpringParams={...this.posXSpringParams,...e},this.lyricLinesEl.forEach(r=>r.lineTransforms.posX.updateParams(this.posXSpringParams))}setLinePosYSpringParams(e){this.posYSpringParams={...this.posYSpringParams,...e},this.lyricLinesEl.forEach(r=>r.lineTransforms.posY.updateParams(this.posYSpringParams))}setLineScaleSpringParams(e){this.scaleSpringParams={...this.scaleSpringParams,...e},this.lyricLinesEl.forEach(r=>r.lineTransforms.scale.updateParams(this.scaleSpringParams))}dispose(){this.element.remove(),this.resizeObserver.disconnect(),this.style.detach(),this.lyricLinesEl.forEach(e=>e.dispose()),window.removeEventListener("pageshow",this.onPageShow)}}exports.BackgroundRender=D;exports.LyricPlayer=Y;
|
|
1
|
+
"use strict";var B=Object.defineProperty;var D=(c,t,e)=>t in c?B(c,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):c[t]=e;var h=(c,t,e)=>(D(c,typeof t!="symbol"?t+"":t,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("@pixi/display"),k=require("@pixi/app"),g=require("@pixi/filter-blur"),P=require("@pixi/filter-color-matrix"),q=require("@pixi/core"),E=require("@pixi/sprite"),F=require("jss"),O=require("jss-preset-default"),N=/^(((?<hour>[0-9]+):)?(?<min>[0-9]+):)?(?<sec>[0-9]+([\.:]([0-9]+))?)/;function b(c){var e,n,s;const t=N.exec(c);if(t){const a=Number(((e=t.groups)==null?void 0:e.hour)||"0"),l=Number(((n=t.groups)==null?void 0:n.min)||"0"),i=Number(((s=t.groups)==null?void 0:s.sec.replace(/:/,"."))||"0");return Math.floor((a*3600+l*60+i)*1e3)}else throw new TypeError("时间戳字符串解析失败")}function $(c){const e=new DOMParser().parseFromString(c,"application/xml");let n="v1";for(const a of e.querySelectorAll("ttm\\:agent"))if(a.getAttribute("type")==="person"){const l=a.getAttribute("xml:id");l&&(n=l)}const s=[];for(const a of e.querySelectorAll("body p[begin][end]")){const l={words:[],startTime:b(a.getAttribute("begin")??"0:0"),endTime:b(a.getAttribute("end")??"0:0"),translatedLyric:"",romanLyric:"",isBG:!1,isDuet:a.getAttribute("ttm:agent")!==n};let i=null;for(const r of a.childNodes)if(r.nodeType===Node.TEXT_NODE){const o=r.textContent??"";/^(\s+)$/.test(o)?l.words.push({word:" ",startTime:0,endTime:0}):l.words.push({word:o,startTime:0,endTime:0})}else if(r.nodeType===Node.ELEMENT_NODE){const o=r,d=o.getAttribute("ttm:role");if(o.nodeName==="span"&&d)if(d==="x-bg"){const u={words:[],startTime:l.startTime,endTime:l.endTime,translatedLyric:"",romanLyric:"",isBG:!0,isDuet:l.isDuet};for(const p of o.childNodes)if(p.nodeType===Node.TEXT_NODE){const y=p.textContent??"";/^(\s+)$/.test(y)?u.words.push({word:" ",startTime:0,endTime:0}):u.words.push({word:y,startTime:0,endTime:0})}else if(p.nodeType===Node.ELEMENT_NODE){const y=p,T=y.getAttribute("ttm:role");if(y.nodeName==="span"&&T)T==="x-translation"?u.translatedLyric=y.innerHTML.trim():T==="x-roman"&&(u.romanLyric=y.innerHTML.trim());else if(y.hasAttribute("begin")&&y.hasAttribute("end")){const S={word:p.textContent,startTime:b(y.getAttribute("begin")),endTime:b(y.getAttribute("end"))};u.words.push(S)}}const f=u.words[0];u.startTime=f.startTime,f!=null&&f.word.startsWith("(")&&(f.word=f.word.substring(1));const m=u.words[u.words.length-1];u.endTime=m.endTime,m!=null&&m.word.endsWith(")")&&(m.word=m.word.substring(0,m.word.length-1)),i=u}else d==="x-translation"?l.translatedLyric=o.innerHTML:d==="x-roman"&&(l.romanLyric=o.innerHTML);else if(o.hasAttribute("begin")&&o.hasAttribute("end")){const u={word:r.textContent??"",startTime:b(o.getAttribute("begin")),endTime:b(o.getAttribute("end"))};l.words.push(u)}}s.push(l),i&&s.push(i)}return console.log(s),s}const R=Object.freeze(Object.defineProperty({__proto__:null,parseTTML:$},Symbol.toStringTag,{value:"Module"}));class _ extends I.Container{constructor(){super(...arguments);h(this,"time",0)}}class W{constructor(t){h(this,"observer");h(this,"app");h(this,"curContainer");h(this,"lastContainer",new Set);h(this,"onTick",t=>{for(const e of this.lastContainer)e.alpha=Math.max(0,e.alpha-t/60),e.alpha<=0&&(this.app.stage.removeChild(e),this.lastContainer.delete(e));if(this.curContainer){this.curContainer.alpha=Math.min(1,this.curContainer.alpha+t/60);const[e,n,s,a]=this.curContainer.children,l=Math.max(this.app.screen.width,this.app.screen.height);e.position.set(this.app.screen.width/2,this.app.screen.height/2),n.position.set(this.app.screen.width/2.5,this.app.screen.height/2.5),s.position.set(this.app.screen.width/2,this.app.screen.height/2),a.position.set(this.app.screen.width/2,this.app.screen.height/2),e.width=l*Math.sqrt(2),e.height=e.width,n.width=l*.8,n.height=n.width,s.width=l*.5,s.height=s.width,a.width=l*.25,a.height=a.width,this.curContainer.time+=t*this.flowSpeed,e.rotation+=t/1e3*this.flowSpeed,n.rotation-=t/500*this.flowSpeed,s.rotation+=t/1e3*this.flowSpeed,a.rotation-=t/750*this.flowSpeed,s.x=this.app.screen.width/2+this.app.screen.width/4*Math.cos(this.curContainer.time/1e3*.75),s.y=this.app.screen.height/2+this.app.screen.width/4*Math.cos(this.curContainer.time/1e3*.75),a.x=this.app.screen.width/2+this.app.screen.width/4*.1+Math.cos(this.curContainer.time*.006*.75),a.y=this.app.screen.height/2+this.app.screen.width/4*.1+Math.cos(this.curContainer.time*.006*.75)}});h(this,"flowSpeed",2);h(this,"currerntRenderScale",.75);this.canvas=t;const e=t.getBoundingClientRect();this.canvas.width=e.width*this.currerntRenderScale,this.canvas.height=e.height*this.currerntRenderScale,this.observer=new ResizeObserver(()=>{const n=t.getBoundingClientRect();this.canvas.width=Math.max(1,n.width),this.canvas.height=Math.max(1,n.height),this.app.renderer.resize(this.canvas.width*this.currerntRenderScale,this.canvas.height*this.currerntRenderScale),this.rebuildFilters()}),this.observer.observe(t),this.app=new k.Application({view:t,resizeTo:this.canvas,powerPreference:"low-power",backgroundAlpha:0}),this.rebuildFilters(),this.app.ticker.add(this.onTick),this.app.ticker.start()}setFlowSpeed(t){this.flowSpeed=t}setRenderScale(t){this.currerntRenderScale=t;const e=this.canvas.getBoundingClientRect();this.canvas.width=Math.max(1,e.width),this.canvas.height=Math.max(1,e.height),this.app.renderer.resize(this.canvas.width*this.currerntRenderScale,this.canvas.height*this.currerntRenderScale),this.rebuildFilters()}rebuildFilters(){const t=Math.min(this.canvas.width,this.canvas.height),e=new P.ColorMatrixFilter;e.saturate(1.2,!1);const n=new P.ColorMatrixFilter;n.brightness(.6,!1);const s=new P.ColorMatrixFilter;s.contrast(.3,!0),this.app.stage.filters=[],this.app.stage.filters.push(new g.BlurFilter(5,1)),this.app.stage.filters.push(new g.BlurFilter(10,1)),this.app.stage.filters.push(new g.BlurFilter(20,2)),this.app.stage.filters.push(new g.BlurFilter(40,2)),t>512&&this.app.stage.filters.push(new g.BlurFilter(80,2)),t>768&&this.app.stage.filters.push(new g.BlurFilter(160,4)),t>768*2&&this.app.stage.filters.push(new g.BlurFilter(320,4)),this.app.stage.filters.push(e,n,s),this.app.stage.filters.push(new g.BlurFilter(5,1))}setFPS(t){this.app.ticker.maxFPS=t}pause(){this.app.ticker.stop(),this.app.render()}resume(){this.app.ticker.start()}async setAlbumImage(t){const e=await q.Texture.fromURL(t),n=new _,s=new E.Sprite(e),a=new E.Sprite(e),l=new E.Sprite(e),i=new E.Sprite(e);s.anchor.set(.5,.5),a.anchor.set(.5,.5),l.anchor.set(.5,.5),i.anchor.set(.5,.5),s.rotation=Math.random()*Math.PI*2,a.rotation=Math.random()*Math.PI*2,l.rotation=Math.random()*Math.PI*2,i.rotation=Math.random()*Math.PI*2,n.addChild(s,a,l,i),this.curContainer&&this.lastContainer.add(this.curContainer),this.curContainer=n,this.app.stage.addChild(this.curContainer),this.curContainer.alpha=0}dispose(){this.observer.disconnect(),this.app.ticker.remove(this.onTick)}}class G extends W{constructor(){const e=document.createElement("canvas");super(e);h(this,"element");this.element=e,e.style.pointerEvents="none",e.style.zIndex="-1"}getElement(){return this.element}dispose(){super.dispose(),this.element.remove()}}const X=(c,t)=>c.size===t.size&&[...c].every(e=>t.has(e));function Y(c){const e=2.5949095;return c<.5?Math.pow(2*c,2)*((e+1)*2*c-e)/2:(Math.pow(2*c-2,2)*((e+1)*(c*2-2)+e)+2)/2}const L=(c,t,e)=>Math.max(c,Math.min(t,e));class V{constructor(t){h(this,"element",document.createElement("div"));h(this,"dot0",document.createElement("span"));h(this,"dot1",document.createElement("span"));h(this,"dot2",document.createElement("span"));h(this,"left",0);h(this,"top",0);h(this,"scale",1);h(this,"lastStyle","");h(this,"currentInterlude");h(this,"currentTime",0);h(this,"targetBreatheDuration",1500);this.lyricPlayer=t,this.element.className=this.lyricPlayer.style.classes.interludeDots,this.element.appendChild(this.dot0),this.element.appendChild(this.dot1),this.element.appendChild(this.dot2)}getElement(){return this.element}setTransform(t=this.left,e=this.top){this.left=t,this.top=e,this.update()}setInterlude(t){this.currentInterlude=t,this.currentTime=(t==null?void 0:t[0])??0}update(t=0){this.currentTime+=t;let e="";if(e+=`transform:translate(${this.left}px, ${this.top}px)`,this.currentInterlude){const n=this.currentInterlude[1]-this.currentInterlude[0],s=this.currentTime-this.currentInterlude[0];if(s<=n){const a=n/Math.ceil(n/this.targetBreatheDuration);let l=1,i=1;l*=Math.sin(1.5*Math.PI-s/a*2)/10+1,s<1e3&&(l*=1-Math.pow((1e3-s)/1e3,2)),s<500?i=0:s<1e3&&(i*=(s-500)/500),n-s<750&&(l*=1-Y((750-(n-s))/750/2)),n-s<375&&(i*=L(0,(n-s)/375,1)),l=Math.max(0,l),e+=` scale(${l})`;const r=L(.25,s*3/n*.75,1),o=L(.25,(s-n/3)*3/n*.75,1),d=L(.25,(s-n/3*2)*3/n*.75,1);this.dot0.style.opacity=`${L(0,Math.max(0,i*r),1)}`,this.dot1.style.opacity=`${L(0,Math.max(0,i*o),1)}`,this.dot2.style.opacity=`${L(0,Math.max(0,i*d),1)}`}else e+=" scale(0)",this.dot0.style.opacity="0",this.dot1.style.opacity="0",this.dot2.style.opacity="0"}else e+=" scale(0)",this.dot0.style.opacity="0",this.dot1.style.opacity="0",this.dot2.style.opacity="0";e+=";",this.lastStyle!==e&&(this.element.setAttribute("style",e),this.lastStyle=e)}dispose(){this.element.remove()}}class x{constructor(t=0){h(this,"currentPosition",0);h(this,"targetPosition",0);h(this,"currentTime",0);h(this,"params",{});h(this,"currentSolver");h(this,"getV");h(this,"queueParams");h(this,"queuePosition");this.targetPosition=t,this.currentPosition=this.targetPosition,this.currentSolver=()=>this.targetPosition,this.getV=()=>0}resetSolver(){const t=this.getV(this.currentTime);this.currentTime=0,this.currentSolver=j(this.currentPosition,t,this.targetPosition,0,this.params),this.getV=H(this.currentSolver)}arrived(){return Math.abs(this.targetPosition-this.currentPosition)<.01&&this.getV(this.currentTime)<.01&&this.queueParams===void 0&&this.queuePosition===void 0}setPosition(t){this.targetPosition=t,this.currentPosition=t,this.currentSolver=()=>this.targetPosition,this.getV=()=>0}update(t=0){this.currentTime+=t,this.currentPosition=this.currentSolver(this.currentTime),this.queueParams&&(this.queueParams.time-=t,this.queueParams.time<=0&&this.updateParams({...this.queueParams})),this.queuePosition&&(this.queuePosition.time-=t,this.queuePosition.time<=0&&this.setTargetPosition(this.queuePosition.position)),this.arrived()&&this.setPosition(this.targetPosition)}updateParams(t,e=0){e>0?this.queueParams={...t,time:e}:(this.params={...this.params,...t},this.resetSolver())}setTargetPosition(t,e=0){e>0?this.queuePosition={position:t,time:e}:(this.queuePosition=void 0,this.targetPosition=t,this.resetSolver())}getCurrentPosition(){return this.currentPosition}}function j(c,t,e,n=0,s){const a=(s==null?void 0:s.soft)??!1,l=(s==null?void 0:s.stiffness)??100,i=(s==null?void 0:s.damping)??10,r=(s==null?void 0:s.mass)??1,o=e-c;if(a||1<=i/(2*Math.sqrt(l*r))){const d=-Math.sqrt(l/r),u=-d*o-t;return f=>(f-=n,f<0?c:e-(o+f*u)*Math.E**(f*d))}else{const d=Math.sqrt(4*r*l-i**2),u=(i*o-2*r*t)/d,f=.5*d/r,m=-(.5*i)/r;return p=>(p-=n,p<0?c:e-(Math.cos(p*f)*o+Math.sin(p*f)*u)*Math.E**(p*m))}}function U(c){return e=>(c(e+.001)-c(e-.001))/(2*.001)}function H(c){return U(c)}const w=/^[\p{Unified_Ideograph}\u0800-\u9FFC]+$/u;function J(c,t="rgba(0,0,0,1)",e="rgba(0,0,0,0.5)"){const n=2+c,s=c/n,a=(1-s)/2;return[`linear-gradient(to right,${t} ${a*100}%,${e} ${(a+s)*100}%)`,s,n]}function v(c){return c.endTime-c.startTime>=1e3&&c.word.length<=7}class K{constructor(t,e={words:[],translatedLyric:"",romanLyric:"",startTime:0,endTime:0,isBG:!1,isDuet:!1}){h(this,"element",document.createElement("div"));h(this,"left",0);h(this,"top",0);h(this,"scale",1);h(this,"blur",0);h(this,"delay",0);h(this,"splittedWords",[]);h(this,"lineSize",[0,0]);h(this,"lineTransforms",{posX:new x(0),posY:new x(0),scale:new x(1)});h(this,"isEnabled",!1);h(this,"_hide",!0);h(this,"lastStyle","");this.lyricPlayer=t,this.lyricLine=e,this.element.setAttribute("class",this.lyricPlayer.style.classes.lyricLine),this.lyricLine.isBG&&this.element.classList.add(this.lyricPlayer.style.classes.lyricBgLine),this.lyricLine.isDuet&&this.element.classList.add(this.lyricPlayer.style.classes.lyricDuetLine),this.element.appendChild(document.createElement("div")),this.element.appendChild(document.createElement("div")),this.element.appendChild(document.createElement("div"));const n=this.element.children[0],s=this.element.children[1],a=this.element.children[2];n.setAttribute("class",this.lyricPlayer.style.classes.lyricMainLine),s.setAttribute("class",this.lyricPlayer.style.classes.lyricSubLine),a.setAttribute("class",this.lyricPlayer.style.classes.lyricSubLine),this.rebuildElement(),this.rebuildStyle()}enable(){this.isEnabled=!0,this.element.classList.add("active");const t=this.element.children[0];this.splittedWords.forEach(e=>{e.elementAnimations.forEach(n=>{n.currentTime=0,n.playbackRate=1,n.play()})}),t.classList.add("active")}measureSize(){this._hide&&(this.element.style.display="",this.element.style.visibility="hidden");const t=[this.element.clientWidth,this.element.clientHeight];return this._hide&&(this.element.style.display="none",this.element.style.visibility=""),t}disable(){this.isEnabled=!1,this.element.classList.remove("active");const t=this.element.children[0];this.splittedWords.forEach(e=>{e.elementAnimations.forEach(n=>{n.id==="float-word"&&(n.playbackRate=-1,n.play())})}),t.classList.remove("active")}setLine(t){this.lyricLine=t,this.lyricLine.isBG?this.element.classList.add(this.lyricPlayer.style.classes.lyricBgLine):this.element.classList.remove(this.lyricPlayer.style.classes.lyricBgLine),this.lyricLine.isDuet?this.element.classList.add(this.lyricPlayer.style.classes.lyricDuetLine):this.element.classList.remove(this.lyricPlayer.style.classes.lyricDuetLine),this.rebuildElement(),this.rebuildStyle()}getLine(){return this.lyricLine}show(){this._hide=!1,this.rebuildStyle()}hide(){this._hide=!0,this.rebuildStyle()}rebuildStyle(){if(this._hide){this.lastStyle!=="display:none;transform:translate(0,-10000px);"&&(this.lastStyle="display:none;transform:translate(0,-10000px);",this.element.setAttribute("style","display:none;transform:translate(0,-10000px);"));return}let t=`transform:translate(${this.lineTransforms.posX.getCurrentPosition()}px,${this.lineTransforms.posY.getCurrentPosition()}px) scale(${this.lineTransforms.scale.getCurrentPosition()});`;!this.lyricPlayer.getEnableSpring()&&this.isInSight&&(t+=`transition-delay:${this.delay}ms;`),t+=`filter:blur(${Math.min(32,this.blur)}px);`,t!==this.lastStyle&&(this.lastStyle=t,this.element.setAttribute("style",t))}rebuildElement(){const t=this.element.children[0],e=this.element.children[1],n=this.element.children[2];this.splittedWords=[],this.lyricLine.words.forEach(r=>{if(w.test(r.word))this.splittedWords.push({...r,width:0,height:0,elements:[],elementAnimations:[],shouldEmphasize:v(r)});else{const o=/(\s*)(\S*)(\s*)/.exec(r.word);o&&(o[1].length>0&&this.splittedWords.push({word:" ",startTime:0,endTime:0,width:0,height:0,elements:[],elementAnimations:[],shouldEmphasize:!1}),this.splittedWords.push({word:o[2],startTime:r.startTime,endTime:r.endTime,width:0,height:0,elements:[],elementAnimations:[],shouldEmphasize:v(r)}),o[3].length>0&&this.splittedWords.push({word:" ",startTime:0,endTime:0,width:0,height:0,elements:[],elementAnimations:[],shouldEmphasize:!1}))}});const s=[],a=[];function l(r){for(;r.firstChild;)r.firstChild.nodeType===Node.ELEMENT_NODE?s.push(t.firstChild):r.firstChild.nodeType===Node.TEXT_NODE&&a.push(t.firstChild),r.removeChild(r.firstChild),l(r.firstChild)}l(t);let i=null;this.splittedWords.forEach(r=>{if(r.word.trim().length>0)if(r.shouldEmphasize){const o=s.pop()??document.createElement("span");o.className="emphasize",r.elements=[o];for(const d of r.word){const u=s.pop()??document.createElement("span");u.className="",u.innerText=d,o.appendChild(u),r.elements.push(u)}if(r.elementAnimations=this.initEmphasizeAnimation(r),console.log(r.word,w.test(r.word)),i&&!w.test(r.word))if(i.childElementCount>0)i.appendChild(o);else{const d=s.pop()??document.createElement("span");d.className="",i.remove(),d.appendChild(i),d.appendChild(o),t.appendChild(d),i=d}else i=w.test(r.word)?null:o,t.appendChild(o)}else{const o=s.pop()??document.createElement("span");if(o.className="",o.innerText=r.word,r.elements=[o],r.elementAnimations.push(this.initFloatAnimation(r,o)),i)if(i.childElementCount>0)i.appendChild(o);else{const d=s.pop()??document.createElement("span");d.className="",i.remove(),d.appendChild(i),d.appendChild(o),t.appendChild(d),i=d}else i=o,t.appendChild(o)}else if(r.word.length>0){const o=a.pop()??document.createTextNode(" ");t.appendChild(o),i=null}else i=null}),e.innerText=this.lyricLine.translatedLyric,n.innerText=this.lyricLine.romanLyric}initFloatAnimation(t,e){const n=e.animate([{transform:"translateY(0px)"},{transform:"translateY(-3%)"}],{duration:Math.max(1e3,t.endTime-t.startTime),delay:t.startTime-this.lyricLine.startTime,id:"float-word",composite:"add",fill:"both"});return n.pause(),n}initEmphasizeAnimation(t){const e=t.startTime-this.lyricLine.startTime,n=t.endTime-t.startTime;return t.elements.map((s,a,l)=>{if(a===0)return this.initFloatAnimation(t,s);{const i=s.animate([{offset:0,transform:"translate3d(0, 0px, 0px)",filter:"drop-shadow(0 0 0 var(--amll-lyric-line-color))"},{offset:.5,transform:"translate3d(0, -2%, 20px)",filter:"drop-shadow(0 0 0.2rem var(--amll-lyric-line-color))"},{offset:1,transform:"translate3d(0, 0px, 0)",filter:"drop-shadow(0 0 0 var(--amll-lyric-line-color))"}],{duration:Math.max(1e3,t.endTime-t.startTime),delay:e+n/(l.length-1)*(a-1),id:"glow-word",iterations:1,composite:"replace",fill:"both"});return i.pause(),i}})}updateMaskImage(){this._hide&&(this.element.style.display="",this.element.style.visibility="hidden"),this.splittedWords.forEach(t=>{const e=t.elements[0];if(e){t.width=e.clientWidth,t.height=e.clientHeight;const[n,s,a]=J(16/t.width,"rgba(0,0,0,0.75)","rgba(0,0,0,0.25)"),l=`${a*100}% 100%`;this.lyricPlayer.supportMaskImage?(e.style.maskImage=n,e.style.maskOrigin="left",e.style.maskSize=l):(e.style.webkitMaskImage=n,e.style.webkitMaskOrigin="left",e.style.webkitMaskSize=l);const i=t.width+16,r=`clamp(${-i}px,calc(${-i}px + (var(--amll-player-time) - ${t.startTime})*${i/Math.abs(t.endTime-t.startTime)}px),0px) 0px, left top`;e.style.maskPosition=r,e.style.webkitMaskPosition=r}}),this._hide&&(this.element.style.display="none",this.element.style.visibility="")}getElement(){return this.element}setTransform(t=this.left,e=this.top,n=this.scale,s=1,a=0,l=!1,i=0){this.left=t,this.top=e,this.scale=n,this.delay=i*1e3|0;const r=this.element.children[0];r.style.opacity=`${s}`,l||!this.lyricPlayer.getEnableSpring()?(this.blur=Math.min(32,a),l&&this.element.classList.add(this.lyricPlayer.style.classes.tmpDisableTransition),this.lineTransforms.posX.setPosition(t),this.lineTransforms.posY.setPosition(e),this.lineTransforms.scale.setPosition(n),this.lyricPlayer.getEnableSpring()?this.rebuildStyle():this.show(),l&&requestAnimationFrame(()=>{this.element.classList.remove(this.lyricPlayer.style.classes.tmpDisableTransition)})):(this.lineTransforms.posX.setTargetPosition(t,i),this.lineTransforms.posY.setTargetPosition(e,i),this.lineTransforms.scale.setTargetPosition(n),this.blur!==Math.min(32,a)&&(this.blur=Math.min(32,a),this.element.style.filter=`blur(${Math.min(32,a)}px)`))}update(t=0){this.lyricPlayer.getEnableSpring()&&(this.lineTransforms.posX.update(t),this.lineTransforms.posY.update(t),this.lineTransforms.scale.update(t),this.isInSight?this.show():this.hide())}get isInSight(){const t=this.lineTransforms.posX.getCurrentPosition(),e=this.lineTransforms.posY.getCurrentPosition(),n=t+this.lineSize[0],s=e+this.lineSize[1],a=this.lyricPlayer.pos[0],l=this.lyricPlayer.pos[1],i=this.lyricPlayer.pos[0]+this.lyricPlayer.size[0],r=this.lyricPlayer.pos[1]+this.lyricPlayer.size[1];return!(t>i||e>r||n<a||s<l)}dispose(){this.element.remove()}}const Q=F.create(O());class Z extends EventTarget{constructor(){super();h(this,"element",document.createElement("div"));h(this,"currentTime",0);h(this,"lyricLines",[]);h(this,"processedLines",[]);h(this,"lyricLinesEl",[]);h(this,"lyricLinesSize",new Map);h(this,"hotLines",new Set);h(this,"bufferedLines",new Set);h(this,"scrollToIndex",0);h(this,"resizeObserver",new ResizeObserver(e=>{const n=e[0].contentRect;this.size[0]=n.width,this.size[1]=n.height,this.pos[0]=n.left,this.pos[1]=n.top,this.rebuildStyle(),this.calcLayout(!0),this.lyricLinesEl.forEach(s=>s.updateMaskImage())}));h(this,"posXSpringParams",{mass:1,damping:10,stiffness:100});h(this,"posYSpringParams",{mass:1,damping:15,stiffness:100});h(this,"scaleSpringParams",{mass:1,damping:20,stiffness:100});h(this,"enableBlur",!0);h(this,"interludeDots");h(this,"interludeDotsSize",[0,0]);h(this,"supportPlusLighter",CSS.supports("mix-blend-mode","plus-lighter"));h(this,"supportMaskImage",CSS.supports("mask-image","none"));h(this,"disableSpring",!1);h(this,"alignAnchor",.5);h(this,"size",[0,0]);h(this,"pos",[0,0]);h(this,"style",Q.createStyleSheet({lyricPlayer:{userSelect:"none",padding:"1rem",boxSizing:"border-box",fontSize:"max(5vh, 12px)",fontWeight:"bold",width:"100%",height:"100%",overflow:"hidden",maxWidth:"100%",maxHeight:"100%",zIndex:1,color:"var(--amll-lyric-line-color)",mixBlendMode:"plus-lighter",contain:"strict"},lyricLine:{position:"absolute",transformOrigin:"left",maxWidth:"65%",padding:"max(2vh, 1rem) 1rem",contain:"content",transition:"filter 0.25s",margin:"max(2vh, 1rem) -1rem"},"@media (max-width: 1024px)":{lyricLine:{maxWidth:"75%",padding:"max(1vh, 1rem) 1rem",margin:"0 -1rem"}},lyricDuetLine:{textAlign:"right",transformOrigin:"right"},lyricBgLine:{opacity:0,fontSize:"max(50%, 10px)",transition:"opacity 0.25s","&.active":{transition:"opacity 0.25s 0.25s",opacity:1}},lyricMainLine:{transition:"opacity 0.3s 0.25s",margin:"-1rem",padding:"1rem","& span":{display:"inline-block",margin:"-1rem",padding:"1rem"},"& > span":{whiteSpace:"pre-wrap",wordBreak:"keep-all",maxLines:"1","&.emphasize":{margin:"-1rem",padding:"1rem",transformStyle:"preserve-3d",perspective:"50vw"}}},lyricSubLine:{fontSize:"max(50%, 10px)",opacity:.5},disableSpring:{"& > *":{transition:"filter 0.25s, transform 0.5s"}},interludeDots:{height:"min(1rem,2.5vh)",transformOrigin:"center",width:"fit-content",padding:"2.5% 0",position:"absolute",display:"flex",gap:"0.5rem","& > *":{width:"100%",display:"inline-block",borderRadius:"50%",aspectRatio:"1 / 1",backgroundColor:"var(--amll-lyric-line-color)",marginRight:"4px"},"&.duet":{right:"1rem",transformOrigin:"center"}},"@supports (mix-blend-mode: plus-lighter)":{lyricSubLine:{opacity:.3}},tmpDisableTransition:{transition:"none !important"}}));h(this,"onPageShow",()=>{this.calcLayout(!0)});this.interludeDots=new V(this),this.element.setAttribute("class",this.style.classes.lyricPlayer),this.disableSpring&&this.element.classList.add(this.style.classes.disableSpring),this.rebuildStyle(),this.resizeObserver.observe(this.element),this.element.appendChild(this.interludeDots.getElement()),this.style.attach(),this.interludeDots.setTransform(0,200),window.addEventListener("pageshow",this.onPageShow)}setEnableSpring(e=!0){this.disableSpring=!e,e?this.element.classList.remove(this.style.classes.disableSpring):this.element.classList.add(this.style.classes.disableSpring),this.calcLayout(!0)}getEnableSpring(){return!this.disableSpring}getCurrentInterlude(){var s,a,l;if(this.bufferedLines.size>0)return;const e=this.currentTime+20,n=this.scrollToIndex;if(n===0){if((s=this.processedLines[0])!=null&&s.startTime&&this.processedLines[0].startTime>e)return[0,this.processedLines[0].startTime]}else if((a=this.processedLines[n])!=null&&a.endTime&&((l=this.processedLines[n+1])!=null&&l.startTime)&&this.processedLines[n+1].startTime>e&&this.processedLines[n].endTime<e)return[this.processedLines[n].endTime,this.processedLines[n+1].startTime]}rebuildStyle(){let e="";e+="--amll-lyric-player-width:",e+=this.element.clientWidth,e+="px;",e+="--amll-lyric-player-height:",e+=this.element.clientHeight,e+="px;",e+="--amll-lyric-line-color:",e+="#FFFFFF;",e+="--amll-player-time:",e+=this.currentTime,e+=";",this.element.setAttribute("style",e)}setEnableBlur(e){this.enableBlur!==e&&(this.enableBlur=e,this.calcLayout())}setLyricLines(e){this.lyricLines=e;const n=750;this.processedLines=e.map((s,a,l)=>{if(s.isBG)return{...s};{const i=l[a-1],r=l[a-2];if(i!=null&&i.isBG&&r){if(r.endTime<s.startTime)return{...s,startTime:Math.max(r.endTime,s.startTime-n)||s.startTime}}else if(i!=null&&i.endTime&&i.endTime<s.startTime)return{...s,startTime:Math.max(i==null?void 0:i.endTime,s.startTime-n)||s.startTime};return{...s}}}),this.processedLines.forEach((s,a,l)=>{const i=l[a+1],r=s.words[s.words.length-1];r&&v(r)&&(i?i.startTime>s.endTime&&(s.endTime=Math.min(s.endTime+1500,i.startTime)):s.endTime=s.endTime+1500)}),this.processedLines.forEach((s,a,l)=>{if(s.isBG)return;const i=l[a+1];i!=null&&i.isBG&&(i.startTime=Math.min(i.startTime,s.startTime))}),this.lyricLinesEl.forEach(s=>s.dispose()),this.lyricLinesEl=this.processedLines.map(s=>new K(this,s)),this.lyricLinesEl.forEach(s=>{this.element.appendChild(s.getElement()),s.updateMaskImage()}),this.setLinePosXSpringParams({}),this.setLinePosYSpringParams({}),this.setLineScaleSpringParams({}),this.setCurrentTime(0,!0),this.calcLayout(!0)}calcLayout(e=!1){var d,u,f;e&&(this.lyricLinesEl.forEach(m=>{const p=m.measureSize();this.lyricLinesSize.set(m,p),m.lineSize=p}),this.interludeDotsSize[0]=this.interludeDots.getElement().clientWidth,this.interludeDotsSize[1]=this.interludeDots.getElement().clientHeight);const n=.95;let a=-this.lyricLinesEl.slice(0,this.scrollToIndex).reduce((m,p)=>{var y;return m+(p.getLine().isBG?0:((y=this.lyricLinesSize.get(p))==null?void 0:y[1])??0)},0);if(this.alignAnchor==="bottom"){a+=this.element.clientHeight/2;const m=this.lyricLinesEl[this.scrollToIndex];if(m){const p=((d=this.lyricLinesSize.get(m))==null?void 0:d[1])??0;a-=p/2}}else if(typeof this.alignAnchor=="number"){a+=this.element.clientHeight*this.alignAnchor;const m=this.lyricLinesEl[this.scrollToIndex];if(m){const p=((u=this.lyricLinesSize.get(m))==null?void 0:u[1])??0;a-=p/2}}const l=this.currentTime===0?void 0:this.getCurrentInterlude();let i=0;if(l&&(i=l[1]-l[0],i>=5e3)){const m=this.currentTime===0?this.lyricLinesEl[0]:this.lyricLinesEl[this.scrollToIndex+1];m&&(a-=((f=this.lyricLinesSize.get(m))==null?void 0:f[1])??0)}const r=Math.max(...this.bufferedLines);let o=0;this.lyricLinesEl.forEach((m,p)=>{var C,z,A;const y=this.bufferedLines.has(p),T=y||p>=this.scrollToIndex&&p<r,S=m.getLine();let M=0;S.isDuet&&(M=this.size[0]-(((C=this.lyricLinesSize.get(m))==null?void 0:C[0])??0)),p===this.scrollToIndex+1&&i>=5e3&&(this.interludeDots.setTransform(0,a),this.interludeDots.setInterlude(this.getCurrentInterlude()),a+=this.interludeDotsSize[1]),m.setTransform(M,a,T?1:n,y?1:1/3,this.enableBlur?3*(T?0:1+(p<this.scrollToIndex?Math.abs(this.scrollToIndex-p):Math.abs(p-Math.max(this.scrollToIndex,r)))):0,e,o),S.isBG&&T?a+=((z=this.lyricLinesSize.get(m))==null?void 0:z[1])??0:S.isBG||(a+=((A=this.lyricLinesSize.get(m))==null?void 0:A[1])??0),a>=0&&(o+=.05)})}getCurrentTime(){return this.currentTime}getLyricLines(){return this.lyricLines}getElement(){return this.element}setAlignAnchor(e){this.alignAnchor=e}setCurrentTime(e,n=!1){this.currentTime=e,this.element.style.setProperty("--amll-player-time",`${e}`);const s=new Set,a=new Set,l=new Set;this.hotLines.forEach(i=>{const r=this.processedLines[i];if(!r.isBG)if(r){const o=this.processedLines[i+1];if(o!=null&&o.isBG){const d=Math.min(r.startTime,o==null?void 0:o.startTime),u=Math.max(r.endTime,o==null?void 0:o.endTime);(d>e||u<=e)&&(this.hotLines.delete(i),s.add(i),this.hotLines.delete(i+1),s.add(i+1),n&&(this.lyricLinesEl[i].disable(),this.lyricLinesEl[i+1].disable()))}else(r.startTime>e||r.endTime<=e)&&(this.hotLines.delete(i),s.add(i),n&&this.lyricLinesEl[i].disable())}else this.hotLines.delete(i),s.add(i),n&&this.lyricLinesEl[i].disable()}),this.processedLines.forEach((i,r,o)=>{var d;!i.isBG&&i.startTime<=e&&i.endTime>e&&(this.hotLines.has(r)||(this.hotLines.add(r),l.add(r),n&&this.lyricLinesEl[r].enable(),(d=o[r+1])!=null&&d.isBG&&(this.hotLines.add(r+1),l.add(r+1),n&&this.lyricLinesEl[r+1].enable())))}),this.bufferedLines.forEach(i=>{this.hotLines.has(i)||(a.add(i),n&&this.lyricLinesEl[i].disable())}),n?(this.bufferedLines.size>0?this.scrollToIndex=Math.min(...this.bufferedLines):this.scrollToIndex=this.processedLines.findIndex(i=>i.startTime>=e),this.bufferedLines.clear(),this.hotLines.forEach(i=>this.bufferedLines.add(i)),this.calcLayout(!0)):(a.size>0||l.size>0)&&(a.size===0&&l.size>0?(l.forEach(i=>{this.bufferedLines.add(i),this.lyricLinesEl[i].enable()}),this.scrollToIndex=Math.min(...this.bufferedLines)):l.size===0&&a.size>0?X(a,this.bufferedLines)&&this.bufferedLines.forEach(i=>{this.hotLines.has(i)||(this.bufferedLines.delete(i),this.lyricLinesEl[i].disable())}):(l.forEach(i=>{this.bufferedLines.add(i),this.lyricLinesEl[i].enable()}),a.forEach(i=>{this.bufferedLines.delete(i),this.lyricLinesEl[i].disable()}),this.bufferedLines.size>0&&(this.scrollToIndex=Math.min(...this.bufferedLines))),this.calcLayout())}update(e=0){const n=e/1e3;this.interludeDots.update(e),this.lyricLinesEl.forEach(s=>s.update(n))}setLinePosXSpringParams(e){this.posXSpringParams={...this.posXSpringParams,...e},this.lyricLinesEl.forEach(n=>n.lineTransforms.posX.updateParams(this.posXSpringParams))}setLinePosYSpringParams(e){this.posYSpringParams={...this.posYSpringParams,...e},this.lyricLinesEl.forEach(n=>n.lineTransforms.posY.updateParams(this.posYSpringParams))}setLineScaleSpringParams(e){this.scaleSpringParams={...this.scaleSpringParams,...e},this.lyricLinesEl.forEach(n=>n.lineTransforms.scale.updateParams(this.scaleSpringParams))}dispose(){this.element.remove(),this.resizeObserver.disconnect(),this.style.detach(),this.lyricLinesEl.forEach(e=>e.dispose()),window.removeEventListener("pageshow",this.onPageShow)}}exports.BackgroundRender=G;exports.LyricPlayer=Z;exports.ttml=R;
|
|
2
|
+
//# sourceMappingURL=amll-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amll-core.js","sources":["../src/lyric/ttml.ts","../src/bg-render/pixi-renderer.ts","../src/bg-render/index.ts","../src/utils/eq-set.ts","../src/lyric-player/interlude-dots.ts","../src/utils/spring.ts","../src/lyric-player/lyric-line.ts","../src/lyric-player/index.ts"],"sourcesContent":["import { LyricLine, LyricWord } from \"../interfaces\";\n\nconst timeRegexp =\n\t/^(((?<hour>[0-9]+):)?(?<min>[0-9]+):)?(?<sec>[0-9]+([\\.:]([0-9]+))?)/;\nfunction parseTimespan(timeSpan: string): number {\n\tconst matches = timeRegexp.exec(timeSpan);\n\tif (matches) {\n\t\tconst hour = Number(matches.groups?.hour || \"0\");\n\t\tconst min = Number(matches.groups?.min || \"0\");\n\t\tconst sec = Number(matches.groups?.sec.replace(/:/, \".\") || \"0\");\n\t\treturn Math.floor((hour * 3600 + min * 60 + sec) * 1000);\n\t} else {\n\t\tthrow new TypeError(\"时间戳字符串解析失败\");\n\t}\n}\n\nexport function parseTTML(ttmlText: string): LyricLine[] {\n\tconst domParser = new DOMParser();\n\tconst ttmlDoc: XMLDocument = domParser.parseFromString(\n\t\tttmlText,\n\t\t\"application/xml\",\n\t);\n\n\tlet mainAgentId = \"v1\";\n\n\tfor (const agent of ttmlDoc.querySelectorAll(\"ttm\\\\:agent\")) {\n\t\tif (agent.getAttribute(\"type\") === \"person\") {\n\t\t\tconst id = agent.getAttribute(\"xml:id\");\n\t\t\tif (id) {\n\t\t\t\tmainAgentId = id;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst result: LyricLine[] = [];\n\n\tfor (const lineEl of ttmlDoc.querySelectorAll(\"body p[begin][end]\")) {\n\t\tconst line: LyricLine = {\n\t\t\twords: [],\n\t\t\tstartTime: parseTimespan(lineEl.getAttribute(\"begin\") ?? \"0:0\"),\n\t\t\tendTime: parseTimespan(lineEl.getAttribute(\"end\") ?? \"0:0\"),\n\t\t\ttranslatedLyric: \"\",\n\t\t\tromanLyric: \"\",\n\t\t\tisBG: false,\n\t\t\tisDuet: lineEl.getAttribute(\"ttm:agent\") !== mainAgentId,\n\t\t};\n\t\tlet curBGLine: LyricLine | null = null;\n\n\t\tfor (const wordNode of lineEl.childNodes) {\n\t\t\tif (wordNode.nodeType === Node.TEXT_NODE) {\n\t\t\t\tconst word = wordNode.textContent ?? \"\";\n\t\t\t\tif (/^(\\s+)$/.test(word)) {\n\t\t\t\t\tline.words.push({\n\t\t\t\t\t\tword: \" \",\n\t\t\t\t\t\tstartTime: 0,\n\t\t\t\t\t\tendTime: 0,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tline.words.push({\n\t\t\t\t\t\tword: word,\n\t\t\t\t\t\tstartTime: 0,\n\t\t\t\t\t\tendTime: 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (wordNode.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\tconst wordEl = wordNode as Element;\n\t\t\t\tconst role = wordEl.getAttribute(\"ttm:role\");\n\n\t\t\t\tif (wordEl.nodeName === \"span\" && role) {\n\t\t\t\t\tif (role === \"x-bg\") {\n\t\t\t\t\t\tconst bgLine: LyricLine = {\n\t\t\t\t\t\t\twords: [],\n\t\t\t\t\t\t\tstartTime: line.startTime,\n\t\t\t\t\t\t\tendTime: line.endTime,\n\t\t\t\t\t\t\ttranslatedLyric: \"\",\n\t\t\t\t\t\t\tromanLyric: \"\",\n\t\t\t\t\t\t\tisBG: true,\n\t\t\t\t\t\t\tisDuet: line.isDuet,\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tfor (const wordNode of wordEl.childNodes) {\n\t\t\t\t\t\t\tif (wordNode.nodeType === Node.TEXT_NODE) {\n\t\t\t\t\t\t\t\tconst word = wordNode.textContent ?? \"\";\n\t\t\t\t\t\t\t\tif (/^(\\s+)$/.test(word)) {\n\t\t\t\t\t\t\t\t\tbgLine.words.push({\n\t\t\t\t\t\t\t\t\t\tword: \" \",\n\t\t\t\t\t\t\t\t\t\tstartTime: 0,\n\t\t\t\t\t\t\t\t\t\tendTime: 0,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tbgLine.words.push({\n\t\t\t\t\t\t\t\t\t\tword: word,\n\t\t\t\t\t\t\t\t\t\tstartTime: 0,\n\t\t\t\t\t\t\t\t\t\tendTime: 0,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (wordNode.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\t\t\t\t\tconst wordEl = wordNode as Element;\n\t\t\t\t\t\t\t\tconst role = wordEl.getAttribute(\"ttm:role\");\n\t\t\t\t\t\t\t\tif (wordEl.nodeName === \"span\" && role) {\n\t\t\t\t\t\t\t\t\tif (role === \"x-translation\") {\n\t\t\t\t\t\t\t\t\t\tbgLine.translatedLyric = wordEl.innerHTML.trim();\n\t\t\t\t\t\t\t\t\t} else if (role === \"x-roman\") {\n\t\t\t\t\t\t\t\t\t\tbgLine.romanLyric = wordEl.innerHTML.trim();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\twordEl.hasAttribute(\"begin\") &&\n\t\t\t\t\t\t\t\t\twordEl.hasAttribute(\"end\")\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tconst word = {\n\t\t\t\t\t\t\t\t\t\tword: wordNode.textContent,\n\t\t\t\t\t\t\t\t\t\tstartTime: parseTimespan(wordEl.getAttribute(\"begin\")!!),\n\t\t\t\t\t\t\t\t\t\tendTime: parseTimespan(wordEl.getAttribute(\"end\")!!),\n\t\t\t\t\t\t\t\t\t} as LyricWord;\n\t\t\t\t\t\t\t\t\tbgLine.words.push(word);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst firstWord = bgLine.words[0];\n\t\t\t\t\t\tbgLine.startTime = firstWord.startTime;\n\t\t\t\t\t\tif (firstWord?.word.startsWith(\"(\")) {\n\t\t\t\t\t\t\tfirstWord.word = firstWord.word.substring(1);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst lastWord = bgLine.words[bgLine.words.length - 1];\n\t\t\t\t\t\tbgLine.endTime = lastWord.endTime;\n\t\t\t\t\t\tif (lastWord?.word.endsWith(\")\")) {\n\t\t\t\t\t\t\tlastWord.word = lastWord.word.substring(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tlastWord.word.length - 1,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurBGLine = bgLine;\n\t\t\t\t\t} else if (role === \"x-translation\") {\n\t\t\t\t\t\tline.translatedLyric = wordEl.innerHTML;\n\t\t\t\t\t} else if (role === \"x-roman\") {\n\t\t\t\t\t\tline.romanLyric = wordEl.innerHTML;\n\t\t\t\t\t}\n\t\t\t\t} else if (wordEl.hasAttribute(\"begin\") && wordEl.hasAttribute(\"end\")) {\n\t\t\t\t\tconst word: LyricWord = {\n\t\t\t\t\t\tword: wordNode.textContent ?? \"\",\n\t\t\t\t\t\tstartTime: parseTimespan(wordEl.getAttribute(\"begin\")!!),\n\t\t\t\t\t\tendTime: parseTimespan(wordEl.getAttribute(\"end\")!!),\n\t\t\t\t\t};\n\t\t\t\t\tline.words.push(word);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tresult.push(line);\n\t\tif (curBGLine) {\n\t\t\t// line.startTime = Math.min(line.startTime, curBGLine.startTime);\n\t\t\t// line.endTime = Math.max(line.endTime, curBGLine.endTime);\n\t\t\t// curBGLine.startTime = line.startTime;\n\t\t\t// curBGLine.endTime = line.endTime;\n\t\t\tresult.push(curBGLine);\n\t\t}\n\t}\n\n\tconsole.log(result);\n\n\treturn result;\n}\n","import { Container } from \"@pixi/display\";\nimport { Application } from \"@pixi/app\";\nimport { BlurFilter } from \"@pixi/filter-blur\";\nimport { ColorMatrixFilter } from \"@pixi/filter-color-matrix\";\nimport { Texture } from \"@pixi/core\";\nimport { Sprite } from \"@pixi/sprite\";\nimport { Disposable } from \"../interfaces\";\n\nclass TimedContainer extends Container {\n\tpublic time = 0;\n}\n\nexport class PixiRenderer implements Disposable {\n\tprivate observer: ResizeObserver;\n\tprivate app: Application;\n\tprivate curContainer?: TimedContainer;\n\tprivate lastContainer: Set<TimedContainer> = new Set();\n\tprivate onTick = (delta: number): void => {\n\t\tfor (const lastContainer of this.lastContainer) {\n\t\t\tlastContainer.alpha = Math.max(0, lastContainer.alpha - delta / 60);\n\t\t\tif (lastContainer.alpha <= 0) {\n\t\t\t\tthis.app.stage.removeChild(lastContainer);\n\t\t\t\tthis.lastContainer.delete(lastContainer);\n\t\t\t}\n\t\t}\n\n\t\tif (this.curContainer) {\n\t\t\tthis.curContainer.alpha = Math.min(\n\t\t\t\t1,\n\t\t\t\tthis.curContainer.alpha + delta / 60,\n\t\t\t);\n\t\t\tconst [s1, s2, s3, s4] = this.curContainer.children as Sprite[];\n\t\t\tconst maxSize = Math.max(this.app.screen.width, this.app.screen.height);\n\t\t\ts1.position.set(this.app.screen.width / 2, this.app.screen.height / 2);\n\t\t\ts2.position.set(\n\t\t\t\tthis.app.screen.width / 2.5,\n\t\t\t\tthis.app.screen.height / 2.5,\n\t\t\t);\n\t\t\ts3.position.set(this.app.screen.width / 2, this.app.screen.height / 2);\n\t\t\ts4.position.set(this.app.screen.width / 2, this.app.screen.height / 2);\n\t\t\ts1.width = maxSize * Math.sqrt(2);\n\t\t\ts1.height = s1.width;\n\t\t\ts2.width = maxSize * 0.8;\n\t\t\ts2.height = s2.width;\n\t\t\ts3.width = maxSize * 0.5;\n\t\t\ts3.height = s3.width;\n\t\t\ts4.width = maxSize * 0.25;\n\t\t\ts4.height = s4.width;\n\n\t\t\tthis.curContainer.time += delta * this.flowSpeed;\n\n\t\t\ts1.rotation += (delta / 1000) * this.flowSpeed;\n\t\t\ts2.rotation -= (delta / 500) * this.flowSpeed;\n\t\t\ts3.rotation += (delta / 1000) * this.flowSpeed;\n\t\t\ts4.rotation -= (delta / 750) * this.flowSpeed;\n\n\t\t\ts3.x =\n\t\t\t\tthis.app.screen.width / 2 +\n\t\t\t\t(this.app.screen.width / 4) *\n\t\t\t\t\tMath.cos((this.curContainer.time / 1000) * 0.75);\n\t\t\ts3.y =\n\t\t\t\tthis.app.screen.height / 2 +\n\t\t\t\t(this.app.screen.width / 4) *\n\t\t\t\t\tMath.cos((this.curContainer.time / 1000) * 0.75);\n\n\t\t\ts4.x =\n\t\t\t\tthis.app.screen.width / 2 +\n\t\t\t\t(this.app.screen.width / 4) * 0.1 +\n\t\t\t\tMath.cos(this.curContainer.time * 0.006 * 0.75);\n\t\t\ts4.y =\n\t\t\t\tthis.app.screen.height / 2 +\n\t\t\t\t(this.app.screen.width / 4) * 0.1 +\n\t\t\t\tMath.cos(this.curContainer.time * 0.006 * 0.75);\n\t\t}\n\t};\n\tprivate flowSpeed = 2;\n\tprivate currerntRenderScale = 0.75;\n\tconstructor(private canvas: HTMLCanvasElement) {\n\t\tconst bounds = canvas.getBoundingClientRect();\n\t\tthis.canvas.width = bounds.width * this.currerntRenderScale;\n\t\tthis.canvas.height = bounds.height * this.currerntRenderScale;\n\t\tthis.observer = new ResizeObserver(() => {\n\t\t\tconst bounds = canvas.getBoundingClientRect();\n\t\t\tthis.canvas.width = Math.max(1, bounds.width);\n\t\t\tthis.canvas.height = Math.max(1, bounds.height);\n\t\t\tthis.app.renderer.resize(\n\t\t\t\tthis.canvas.width * this.currerntRenderScale,\n\t\t\t\tthis.canvas.height * this.currerntRenderScale,\n\t\t\t);\n\t\t\tthis.rebuildFilters();\n\t\t});\n\t\tthis.observer.observe(canvas);\n\t\tthis.app = new Application({\n\t\t\tview: canvas,\n\t\t\tresizeTo: this.canvas,\n\t\t\tpowerPreference: \"low-power\",\n\t\t\tbackgroundAlpha: 0,\n\t\t});\n\t\tthis.rebuildFilters();\n\t\tthis.app.ticker.add(this.onTick);\n\t\tthis.app.ticker.start();\n\t}\n\t/**\n\t * 修改背景的流动速度,数字越大越快,默认为 2\n\t * @param speed 背景的流动速度,默认为 2\n\t */\n\tsetFlowSpeed(speed: number) {\n\t\tthis.flowSpeed = speed;\n\t}\n\t/**\n\t * 修改背景的渲染比例,默认是 0.5\n\t *\n\t * 一般情况下这个程度既没有明显瑕疵也不会特别吃性能\n\t * @param scale 背景的渲染比例\n\t */\n\tsetRenderScale(scale: number) {\n\t\tthis.currerntRenderScale = scale;\n\t\tconst bounds = this.canvas.getBoundingClientRect();\n\t\tthis.canvas.width = Math.max(1, bounds.width);\n\t\tthis.canvas.height = Math.max(1, bounds.height);\n\t\tthis.app.renderer.resize(\n\t\t\tthis.canvas.width * this.currerntRenderScale,\n\t\t\tthis.canvas.height * this.currerntRenderScale,\n\t\t);\n\t\tthis.rebuildFilters();\n\t}\n\tprivate rebuildFilters() {\n\t\tconst minBorder = Math.min(this.canvas.width, this.canvas.height);\n\t\tconst c0 = new ColorMatrixFilter();\n\t\tc0.saturate(1.2, false);\n\t\tconst c1 = new ColorMatrixFilter();\n\t\tc1.brightness(0.6, false);\n\t\tconst c2 = new ColorMatrixFilter();\n\t\tc2.contrast(0.3, true);\n\t\tthis.app.stage.filters = [];\n\t\tthis.app.stage.filters.push(new BlurFilter(5, 1));\n\t\tthis.app.stage.filters.push(new BlurFilter(10, 1));\n\t\tthis.app.stage.filters.push(new BlurFilter(20, 2));\n\t\tthis.app.stage.filters.push(new BlurFilter(40, 2));\n\t\tif (minBorder > 512) this.app.stage.filters.push(new BlurFilter(80, 2));\n\t\tif (minBorder > 768) this.app.stage.filters.push(new BlurFilter(160, 4));\n\t\tif (minBorder > 768 * 2)\n\t\t\tthis.app.stage.filters.push(new BlurFilter(320, 4));\n\n\t\tthis.app.stage.filters.push(c0, c1, c2);\n\t\tthis.app.stage.filters.push(new BlurFilter(5, 1));\n\t}\n\t/**\n\t * 修改背景动画帧率,默认是 30 FPS\n\t *\n\t * 如果设置成 0 则会停止动画\n\t * @param fps 目标帧率,默认 30 FPS\n\t */\n\tsetFPS(fps: number) {\n\t\tthis.app.ticker.maxFPS = fps;\n\t}\n\t/**\n\t * 暂停背景动画,画面即便是更新了图片也不会发生变化\n\t */\n\tpause() {\n\t\tthis.app.ticker.stop();\n\t\tthis.app.render();\n\t}\n\t/**\n\t * 恢复播放背景动画\n\t */\n\tresume() {\n\t\tthis.app.ticker.start();\n\t}\n\t/**\n\t * 设置背景专辑图片,图片材质加载并设置完成后会返回\n\t * @param albumUrl 图片的目标链接\n\t */\n\tasync setAlbumImage(albumUrl: string) {\n\t\tconst tex = await Texture.fromURL(albumUrl);\n\t\tconst container = new TimedContainer();\n\t\tconst s1 = new Sprite(tex);\n\t\tconst s2 = new Sprite(tex);\n\t\tconst s3 = new Sprite(tex);\n\t\tconst s4 = new Sprite(tex);\n\t\ts1.anchor.set(0.5, 0.5);\n\t\ts2.anchor.set(0.5, 0.5);\n\t\ts3.anchor.set(0.5, 0.5);\n\t\ts4.anchor.set(0.5, 0.5);\n\t\ts1.rotation = Math.random() * Math.PI * 2;\n\t\ts2.rotation = Math.random() * Math.PI * 2;\n\t\ts3.rotation = Math.random() * Math.PI * 2;\n\t\ts4.rotation = Math.random() * Math.PI * 2;\n\t\tcontainer.addChild(s1, s2, s3, s4);\n\t\tif (this.curContainer) this.lastContainer.add(this.curContainer);\n\t\tthis.curContainer = container;\n\t\tthis.app.stage.addChild(this.curContainer);\n\t\tthis.curContainer.alpha = 0;\n\t}\n\n\tdispose() {\n\t\tthis.observer.disconnect();\n\t\tthis.app.ticker.remove(this.onTick);\n\t}\n}\n","/**\n * @fileoverview\n * 一个播放歌词的组件\n * @author SteveXMH\n */\n\nimport type { HasElement, Disposable } from \"../interfaces\";\nimport { PixiRenderer } from \"./pixi-renderer\";\n\nexport class BackgroundRender\n\textends PixiRenderer\n\timplements HasElement, Disposable\n{\n\tprivate element: HTMLCanvasElement;\n\tconstructor() {\n\t\tconst canvas = document.createElement(\"canvas\");\n\t\tsuper(canvas);\n\t\tthis.element = canvas;\n\t\tcanvas.style.pointerEvents = \"none\";\n\t\tcanvas.style.zIndex = \"-1\";\n\t}\n\tgetElement() {\n\t\treturn this.element;\n\t}\n\tdispose() {\n\t\tsuper.dispose();\n\t\tthis.element.remove();\n\t}\n}\n","export const eqSet: <T>(xs: Set<T>, ys: Set<T>) => boolean = (\n\txs,\n\tys,\n): boolean => xs.size === ys.size && [...xs].every((x) => ys.has(x));\n","import { LyricPlayer } from \".\";\nimport type { Disposable, HasElement } from \"../interfaces\";\n\nfunction easeInOutBack(x: number): number {\n\tconst c1 = 1.70158;\n\tconst c2 = c1 * 1.525;\n\n\treturn x < 0.5\n\t\t? (Math.pow(2 * x, 2) * ((c2 + 1) * 2 * x - c2)) / 2\n\t\t: (Math.pow(2 * x - 2, 2) * ((c2 + 1) * (x * 2 - 2) + c2) + 2) / 2;\n}\n\nconst clamp = (min: number, cur: number, max: number) =>\n\tMath.max(min, Math.min(cur, max));\n\nexport class InterludeDots implements HasElement, Disposable {\n\tprivate element: HTMLElement = document.createElement(\"div\");\n\tprivate dot0: HTMLElement = document.createElement(\"span\");\n\tprivate dot1: HTMLElement = document.createElement(\"span\");\n\tprivate dot2: HTMLElement = document.createElement(\"span\");\n\tprivate left = 0;\n\tprivate top = 0;\n\tprivate scale = 1;\n\tprivate lastStyle = \"\";\n\tprivate currentInterlude?: [number, number];\n\tprivate currentTime = 0;\n\tprivate targetBreatheDuration = 1500;\n\tconstructor(private readonly lyricPlayer: LyricPlayer) {\n\t\tthis.element.className = this.lyricPlayer.style.classes.interludeDots;\n\t\tthis.element.appendChild(this.dot0);\n\t\tthis.element.appendChild(this.dot1);\n\t\tthis.element.appendChild(this.dot2);\n\t}\n\tgetElement() {\n\t\treturn this.element;\n\t}\n\tsetTransform(left: number = this.left, top: number = this.top) {\n\t\tthis.left = left;\n\t\tthis.top = top;\n\t\tthis.update();\n\t}\n\tsetInterlude(interlude?: [number, number]) {\n\t\tthis.currentInterlude = interlude;\n\t\tthis.currentTime = interlude?.[0] ?? 0;\n\t}\n\tupdate(delta = 0) {\n\t\tthis.currentTime += delta;\n\t\tlet curStyle = \"\";\n\n\t\tcurStyle += `transform:translate(${this.left}px, ${this.top}px)`;\n\n\t\t// 计算缩放大小\n\n\t\tif (this.currentInterlude) {\n\t\t\tconst interludeDuration =\n\t\t\t\tthis.currentInterlude[1] - this.currentInterlude[0];\n\t\t\tconst currentDuration = this.currentTime - this.currentInterlude[0];\n\t\t\tif (currentDuration <= interludeDuration) {\n\t\t\t\tconst breatheDuration =\n\t\t\t\t\tinterludeDuration /\n\t\t\t\t\tMath.ceil(interludeDuration / this.targetBreatheDuration);\n\t\t\t\tlet scale = 1;\n\t\t\t\tlet globalOpacity = 1;\n\n\t\t\t\tscale *=\n\t\t\t\t\tMath.sin(1.5 * Math.PI - (currentDuration / breatheDuration) * 2) /\n\t\t\t\t\t\t10 +\n\t\t\t\t\t1;\n\n\t\t\t\tif (currentDuration < 1000) {\n\t\t\t\t\tscale *= 1 - Math.pow((1000 - currentDuration) / 1000, 2);\n\t\t\t\t}\n\n\t\t\t\tif (currentDuration < 500) {\n\t\t\t\t\tglobalOpacity = 0;\n\t\t\t\t} else if (currentDuration < 1000) {\n\t\t\t\t\tglobalOpacity *= (currentDuration - 500) / 500;\n\t\t\t\t}\n\n\t\t\t\tif (interludeDuration - currentDuration < 750) {\n\t\t\t\t\tscale *=\n\t\t\t\t\t\t1 -\n\t\t\t\t\t\teaseInOutBack(\n\t\t\t\t\t\t\t(750 - (interludeDuration - currentDuration)) / 750 / 2,\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (interludeDuration - currentDuration < 375) {\n\t\t\t\t\tglobalOpacity *= clamp(\n\t\t\t\t\t\t0,\n\t\t\t\t\t\t(interludeDuration - currentDuration) / 375,\n\t\t\t\t\t\t1,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tscale = Math.max(0, scale);\n\n\t\t\t\tcurStyle += ` scale(${scale})`;\n\n\t\t\t\tconst dot0Opacity = clamp(\n\t\t\t\t\t0.25,\n\t\t\t\t\t((currentDuration * 3) / interludeDuration) * 0.75,\n\t\t\t\t\t1,\n\t\t\t\t);\n\t\t\t\tconst dot1Opacity = clamp(\n\t\t\t\t\t0.25,\n\t\t\t\t\t(((currentDuration - interludeDuration / 3) * 3) /\n\t\t\t\t\t\tinterludeDuration) *\n\t\t\t\t\t\t0.75,\n\t\t\t\t\t1,\n\t\t\t\t);\n\t\t\t\tconst dot2Opacity = clamp(\n\t\t\t\t\t0.25,\n\t\t\t\t\t(((currentDuration - (interludeDuration / 3) * 2) * 3) /\n\t\t\t\t\t\tinterludeDuration) *\n\t\t\t\t\t\t0.75,\n\t\t\t\t\t1,\n\t\t\t\t);\n\n\t\t\t\tthis.dot0.style.opacity = `${clamp(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.max(0, globalOpacity * dot0Opacity),\n\t\t\t\t\t1,\n\t\t\t\t)}`;\n\t\t\t\tthis.dot1.style.opacity = `${clamp(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.max(0, globalOpacity * dot1Opacity),\n\t\t\t\t\t1,\n\t\t\t\t)}`;\n\t\t\t\tthis.dot2.style.opacity = `${clamp(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.max(0, globalOpacity * dot2Opacity),\n\t\t\t\t\t1,\n\t\t\t\t)}`;\n\t\t\t} else {\n\t\t\t\tcurStyle += \" scale(0)\";\n\t\t\t\tthis.dot0.style.opacity = \"0\";\n\t\t\t\tthis.dot1.style.opacity = \"0\";\n\t\t\t\tthis.dot2.style.opacity = \"0\";\n\t\t\t}\n\t\t} else {\n\t\t\tcurStyle += \" scale(0)\";\n\t\t\tthis.dot0.style.opacity = \"0\";\n\t\t\tthis.dot1.style.opacity = \"0\";\n\t\t\tthis.dot2.style.opacity = \"0\";\n\t\t}\n\n\t\tcurStyle += \";\";\n\n\t\tif (this.lastStyle !== curStyle) {\n\t\t\tthis.element.setAttribute(\"style\", curStyle);\n\t\t\tthis.lastStyle = curStyle;\n\t\t}\n\t}\n\tdispose() {\n\t\tthis.element.remove();\n\t}\n}\n","/** MIT License github.com/pushkine/ */\nexport interface SpringParams {\n\tmass: number; // = 1.0\n\tdamping: number; // = 10.0\n\tstiffness: number; // = 100.0\n\tsoft: boolean; // = false\n}\n\ntype seconds = number;\n\nexport class Spring {\n\tprivate currentPosition = 0;\n\tprivate targetPosition = 0;\n\tprivate currentTime = 0;\n\tprivate params: Partial<SpringParams> = {};\n\tprivate currentSolver: (t: seconds) => number;\n\tprivate getV: (t: seconds) => number;\n\tprivate queueParams:\n\t\t| (Partial<SpringParams> & {\n\t\t\t\ttime: number;\n\t\t })\n\t\t| undefined;\n\tprivate queuePosition:\n\t\t| {\n\t\t\t\ttime: number;\n\t\t\t\tposition: number;\n\t\t }\n\t\t| undefined;\n\tconstructor(currentPosition = 0) {\n\t\tthis.targetPosition = currentPosition;\n\t\tthis.currentPosition = this.targetPosition;\n\t\tthis.currentSolver = () => this.targetPosition;\n\t\tthis.getV = () => 0;\n\t}\n\tprivate resetSolver() {\n\t\tconst curV = this.getV(this.currentTime);\n\t\tthis.currentTime = 0;\n\t\tthis.currentSolver = solveSpring(\n\t\t\tthis.currentPosition,\n\t\t\tcurV,\n\t\t\tthis.targetPosition,\n\t\t\t0,\n\t\t\tthis.params,\n\t\t);\n\t\tthis.getV = getVelocity(this.currentSolver);\n\t}\n\tarrived() {\n\t\treturn (\n\t\t\tMath.abs(this.targetPosition - this.currentPosition) < 0.01 &&\n\t\t\tthis.getV(this.currentTime) < 0.01 &&\n\t\t\tthis.queueParams === undefined &&\n\t\t\tthis.queuePosition === undefined\n\t\t);\n\t}\n\tsetPosition(targetPosition: number) {\n\t\tthis.targetPosition = targetPosition;\n\t\tthis.currentPosition = targetPosition;\n\t\tthis.currentSolver = () => this.targetPosition;\n\t\tthis.getV = () => 0;\n\t}\n\tupdate(delta = 0) {\n\t\tthis.currentTime += delta;\n\t\tthis.currentPosition = this.currentSolver(this.currentTime);\n\t\tif (this.queueParams) {\n\t\t\tthis.queueParams.time -= delta;\n\t\t\tif (this.queueParams.time <= 0) {\n\t\t\t\tthis.updateParams({\n\t\t\t\t\t...this.queueParams,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tif (this.queuePosition) {\n\t\t\tthis.queuePosition.time -= delta;\n\t\t\tif (this.queuePosition.time <= 0) {\n\t\t\t\tthis.setTargetPosition(this.queuePosition.position);\n\t\t\t}\n\t\t}\n\t\tif (this.arrived()) {\n\t\t\tthis.setPosition(this.targetPosition);\n\t\t}\n\t}\n\tupdateParams(params: Partial<SpringParams>, delay = 0) {\n\t\tif (delay > 0) {\n\t\t\tthis.queueParams = {\n\t\t\t\t...params,\n\t\t\t\ttime: delay,\n\t\t\t};\n\t\t} else {\n\t\t\tthis.params = {\n\t\t\t\t...this.params,\n\t\t\t\t...params,\n\t\t\t};\n\t\t\tthis.resetSolver();\n\t\t}\n\t}\n\tsetTargetPosition(targetPosition: number, delay = 0) {\n\t\tif (delay > 0) {\n\t\t\tthis.queuePosition = {\n\t\t\t\tposition: targetPosition,\n\t\t\t\ttime: delay,\n\t\t\t};\n\t\t} else {\n\t\t\tthis.queuePosition = undefined;\n\t\t\tthis.targetPosition = targetPosition;\n\t\t\tthis.resetSolver();\n\t\t}\n\t}\n\tgetCurrentPosition() {\n\t\treturn this.currentPosition;\n\t}\n}\n\nfunction solveSpring(\n\tfrom: number,\n\tvelocity: number,\n\tto: number,\n\tdelay: seconds = 0,\n\tparams?: Partial<SpringParams>,\n): (t: seconds) => number {\n\tconst soft = params?.soft ?? false;\n\tconst stiffness = params?.stiffness ?? 100;\n\tconst damping = params?.damping ?? 10;\n\tconst mass = params?.mass ?? 1;\n\tconst delta = to - from;\n\tif (soft || 1.0 <= damping / (2.0 * Math.sqrt(stiffness * mass))) {\n\t\tconst angular_frequency = -Math.sqrt(stiffness / mass);\n\t\tconst leftover = -angular_frequency * delta - velocity;\n\t\treturn (t: seconds) => {\n\t\t\tt -= delay;\n\t\t\tif (t < 0) return from;\n\t\t\treturn to - (delta + t * leftover) * Math.E ** (t * angular_frequency);\n\t\t};\n\t} else {\n\t\tconst damping_frequency = Math.sqrt(\n\t\t\t4.0 * mass * stiffness - damping ** 2.0,\n\t\t);\n\t\tconst leftover =\n\t\t\t(damping * delta - 2.0 * mass * velocity) / damping_frequency;\n\t\tconst dfm = (0.5 * damping_frequency) / mass;\n\t\tconst dm = -(0.5 * damping) / mass;\n\t\treturn (t: seconds) => {\n\t\t\tt -= delay;\n\t\t\tif (t < 0) return from;\n\t\t\treturn (\n\t\t\t\tto -\n\t\t\t\t(Math.cos(t * dfm) * delta + Math.sin(t * dfm) * leftover) *\n\t\t\t\t\tMath.E ** (t * dm)\n\t\t\t);\n\t\t};\n\t}\n}\n\nfunction derivative(f: (x: number) => number) {\n\tconst h = 0.001;\n\treturn (x: number) => (f(x + h) - f(x - h)) / (2 * h);\n}\n\nfunction getVelocity(f: (t: seconds) => number): (t: seconds) => number {\n\treturn derivative(f);\n}\n","import { LyricPlayer } from \".\";\nimport { Disposable, HasElement, LyricLine, LyricWord } from \"../interfaces\";\nimport { Spring } from \"../utils/spring\";\n\nconst CJKEXP = /^[\\p{Unified_Ideograph}\\u0800-\\u9FFC]+$/u;\n\ninterface RealWord extends LyricWord {\n\telements: HTMLSpanElement[];\n\telementAnimations: Animation[];\n\twidth: number;\n\theight: number;\n\tshouldEmphasize: boolean;\n}\n\nfunction generateFadeGradient(\n\twidth: number,\n\tbright = \"rgba(0,0,0,1)\",\n\tdark = \"rgba(0,0,0,0.5)\",\n): [string, number, number] {\n\tconst totalAspect = 2 + width;\n\tconst widthInTotal = width / totalAspect;\n\tconst leftPos = (1 - widthInTotal) / 2;\n\treturn [\n\t\t`linear-gradient(to right,${bright} ${leftPos * 100}%,${dark} ${\n\t\t\t(leftPos + widthInTotal) * 100\n\t\t}%)`,\n\t\twidthInTotal,\n\t\ttotalAspect,\n\t];\n}\n\n// 果子在对辉光效果的解释是一种强调(emphasized)效果\n// 条件是一个单词时长大于等于 1s 且长度小于等于 7\nexport function shouldEmphasize(word: LyricWord): boolean {\n\treturn word.endTime - word.startTime >= 1000 && word.word.length <= 7;\n}\n\nexport class LyricLineEl implements HasElement, Disposable {\n\tprivate element: HTMLElement = document.createElement(\"div\");\n\tprivate left = 0;\n\tprivate top = 0;\n\tprivate scale = 1;\n\tprivate blur = 0;\n\tprivate delay = 0;\n\tprivate splittedWords: RealWord[] = [];\n\t// 由 LyricPlayer 来设置\n\tlineSize: number[] = [0, 0];\n\treadonly lineTransforms = {\n\t\tposX: new Spring(0),\n\t\tposY: new Spring(0),\n\t\tscale: new Spring(1),\n\t};\n\tconstructor(\n\t\tprivate lyricPlayer: LyricPlayer,\n\t\tprivate lyricLine: LyricLine = {\n\t\t\twords: [],\n\t\t\ttranslatedLyric: \"\",\n\t\t\tromanLyric: \"\",\n\t\t\tstartTime: 0,\n\t\t\tendTime: 0,\n\t\t\tisBG: false,\n\t\t\tisDuet: false,\n\t\t},\n\t) {\n\t\tthis.element.setAttribute(\n\t\t\t\"class\",\n\t\t\tthis.lyricPlayer.style.classes.lyricLine,\n\t\t);\n\t\tif (this.lyricLine.isBG) {\n\t\t\tthis.element.classList.add(this.lyricPlayer.style.classes.lyricBgLine);\n\t\t}\n\t\tif (this.lyricLine.isDuet) {\n\t\t\tthis.element.classList.add(this.lyricPlayer.style.classes.lyricDuetLine);\n\t\t}\n\t\tthis.element.appendChild(document.createElement(\"div\")); // 歌词行\n\t\tthis.element.appendChild(document.createElement(\"div\")); // 翻译行\n\t\tthis.element.appendChild(document.createElement(\"div\")); // 音译行\n\t\tconst main = this.element.children[0] as HTMLDivElement;\n\t\tconst trans = this.element.children[1] as HTMLDivElement;\n\t\tconst roman = this.element.children[2] as HTMLDivElement;\n\t\tmain.setAttribute(\"class\", this.lyricPlayer.style.classes.lyricMainLine);\n\t\ttrans.setAttribute(\"class\", this.lyricPlayer.style.classes.lyricSubLine);\n\t\troman.setAttribute(\"class\", this.lyricPlayer.style.classes.lyricSubLine);\n\t\tthis.rebuildElement();\n\t\tthis.rebuildStyle();\n\t}\n\tprivate isEnabled = false;\n\tenable() {\n\t\tthis.isEnabled = true;\n\t\tthis.element.classList.add(\"active\");\n\t\tconst main = this.element.children[0] as HTMLDivElement;\n\t\tthis.splittedWords.forEach((word) => {\n\t\t\tword.elementAnimations.forEach((a) => {\n\t\t\t\ta.currentTime = 0;\n\t\t\t\ta.playbackRate = 1;\n\t\t\t\ta.play();\n\t\t\t});\n\t\t});\n\t\tmain.classList.add(\"active\");\n\t}\n\tmeasureSize(): [number, number] {\n\t\tif (this._hide) {\n\t\t\tthis.element.style.display = \"\";\n\t\t\tthis.element.style.visibility = \"hidden\";\n\t\t}\n\t\tconst size: [number, number] = [\n\t\t\tthis.element.clientWidth,\n\t\t\tthis.element.clientHeight,\n\t\t];\n\t\tif (this._hide) {\n\t\t\tthis.element.style.display = \"none\";\n\t\t\tthis.element.style.visibility = \"\";\n\t\t}\n\t\treturn size;\n\t}\n\tdisable() {\n\t\tthis.isEnabled = false;\n\t\tthis.element.classList.remove(\"active\");\n\t\tconst main = this.element.children[0] as HTMLDivElement;\n\t\tthis.splittedWords.forEach((word) => {\n\t\t\tword.elementAnimations.forEach((a) => {\n\t\t\t\tif (a.id === \"float-word\") {\n\t\t\t\t\ta.playbackRate = -1;\n\t\t\t\t\ta.play();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\tmain.classList.remove(\"active\");\n\t}\n\tsetLine(line: LyricLine) {\n\t\tthis.lyricLine = line;\n\t\tif (this.lyricLine.isBG) {\n\t\t\tthis.element.classList.add(this.lyricPlayer.style.classes.lyricBgLine);\n\t\t} else {\n\t\t\tthis.element.classList.remove(this.lyricPlayer.style.classes.lyricBgLine);\n\t\t}\n\t\tif (this.lyricLine.isDuet) {\n\t\t\tthis.element.classList.add(this.lyricPlayer.style.classes.lyricDuetLine);\n\t\t} else {\n\t\t\tthis.element.classList.remove(\n\t\t\t\tthis.lyricPlayer.style.classes.lyricDuetLine,\n\t\t\t);\n\t\t}\n\t\tthis.rebuildElement();\n\t\tthis.rebuildStyle();\n\t}\n\tgetLine() {\n\t\treturn this.lyricLine;\n\t}\n\tprivate _hide = true;\n\tprivate lastStyle = \"\";\n\tshow() {\n\t\tthis._hide = false;\n\t\tthis.rebuildStyle();\n\t}\n\thide() {\n\t\tthis._hide = true;\n\t\tthis.rebuildStyle();\n\t}\n\trebuildStyle() {\n\t\tif (this._hide) {\n\t\t\tif (this.lastStyle !== \"display:none;transform:translate(0,-10000px);\") {\n\t\t\t\tthis.lastStyle = \"display:none;transform:translate(0,-10000px);\";\n\t\t\t\tthis.element.setAttribute(\n\t\t\t\t\t\"style\",\n\t\t\t\t\t\"display:none;transform:translate(0,-10000px);\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tlet style = `transform:translate(${this.lineTransforms.posX.getCurrentPosition()}px,${this.lineTransforms.posY.getCurrentPosition()}px) scale(${this.lineTransforms.scale.getCurrentPosition()});`;\n\t\tif (!this.lyricPlayer.getEnableSpring() && this.isInSight) {\n\t\t\tstyle += `transition-delay:${this.delay}ms;`;\n\t\t}\n\t\tstyle += `filter:blur(${Math.min(32, this.blur)}px);`;\n\t\tif (style !== this.lastStyle) {\n\t\t\tthis.lastStyle = style;\n\t\t\tthis.element.setAttribute(\"style\", style);\n\t\t}\n\t}\n\trebuildElement() {\n\t\tconst main = this.element.children[0] as HTMLDivElement;\n\t\tconst trans = this.element.children[1] as HTMLDivElement;\n\t\tconst roman = this.element.children[2] as HTMLDivElement;\n\t\tthis.splittedWords = [];\n\t\tthis.lyricLine.words.forEach((word) => {\n\t\t\tif (CJKEXP.test(word.word)) {\n\t\t\t\tthis.splittedWords.push({\n\t\t\t\t\t...word,\n\t\t\t\t\twidth: 0,\n\t\t\t\t\theight: 0,\n\t\t\t\t\telements: [],\n\t\t\t\t\telementAnimations: [],\n\t\t\t\t\tshouldEmphasize: shouldEmphasize(word),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst splited = /(\\s*)(\\S*)(\\s*)/.exec(word.word);\n\t\t\t\tif (splited) {\n\t\t\t\t\tif (splited[1].length > 0) {\n\t\t\t\t\t\tthis.splittedWords.push({\n\t\t\t\t\t\t\tword: \" \",\n\t\t\t\t\t\t\tstartTime: 0,\n\t\t\t\t\t\t\tendTime: 0,\n\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\telements: [],\n\t\t\t\t\t\t\telementAnimations: [],\n\t\t\t\t\t\t\tshouldEmphasize: false,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tthis.splittedWords.push({\n\t\t\t\t\t\tword: splited[2],\n\t\t\t\t\t\tstartTime: word.startTime,\n\t\t\t\t\t\tendTime: word.endTime,\n\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\telements: [],\n\t\t\t\t\t\telementAnimations: [],\n\t\t\t\t\t\tshouldEmphasize: shouldEmphasize(word),\n\t\t\t\t\t});\n\t\t\t\t\tif (splited[3].length > 0) {\n\t\t\t\t\t\tthis.splittedWords.push({\n\t\t\t\t\t\t\tword: \" \",\n\t\t\t\t\t\t\tstartTime: 0,\n\t\t\t\t\t\t\tendTime: 0,\n\t\t\t\t\t\t\twidth: 0,\n\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\telements: [],\n\t\t\t\t\t\t\telementAnimations: [],\n\t\t\t\t\t\t\tshouldEmphasize: false,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t// 回收元素以复用\n\t\tconst reusableElements: HTMLElement[] = [];\n\t\tconst reusableTextNodes: Text[] = [];\n\t\tfunction collectNodes(curNode: Node) {\n\t\t\twhile (curNode.firstChild) {\n\t\t\t\tif (curNode.firstChild.nodeType === Node.ELEMENT_NODE)\n\t\t\t\t\treusableElements.push(main.firstChild as HTMLElement);\n\t\t\t\telse if (curNode.firstChild.nodeType === Node.TEXT_NODE)\n\t\t\t\t\treusableTextNodes.push(main.firstChild as Text);\n\t\t\t\tcurNode.removeChild(curNode.firstChild);\n\t\t\t\tcollectNodes(curNode.firstChild);\n\t\t\t}\n\t\t}\n\t\tcollectNodes(main);\n\t\tlet lastWordEl: HTMLSpanElement | null = null;\n\t\tthis.splittedWords.forEach((word) => {\n\t\t\tif (word.word.trim().length > 0) {\n\t\t\t\tif (word.shouldEmphasize) {\n\t\t\t\t\tconst wordEl =\n\t\t\t\t\t\treusableElements.pop() ?? document.createElement(\"span\");\n\t\t\t\t\twordEl.className = \"emphasize\";\n\t\t\t\t\tword.elements = [wordEl];\n\t\t\t\t\tfor (const c of word.word) {\n\t\t\t\t\t\tconst charEl =\n\t\t\t\t\t\t\treusableElements.pop() ?? document.createElement(\"span\");\n\t\t\t\t\t\tcharEl.className = \"\";\n\t\t\t\t\t\tcharEl.innerText = c;\n\t\t\t\t\t\twordEl.appendChild(charEl);\n\t\t\t\t\t\tword.elements.push(charEl);\n\t\t\t\t\t}\n\t\t\t\t\tword.elementAnimations = this.initEmphasizeAnimation(word);\n\t\t\t\t\tconsole.log(word.word, CJKEXP.test(word.word));\n\t\t\t\t\tif (lastWordEl && !CJKEXP.test(word.word)) {\n\t\t\t\t\t\tif (lastWordEl.childElementCount > 0) {\n\t\t\t\t\t\t\tlastWordEl.appendChild(wordEl);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst wholeWordEl =\n\t\t\t\t\t\t\t\treusableElements.pop() ?? document.createElement(\"span\");\n\t\t\t\t\t\t\twholeWordEl.className = \"\";\n\t\t\t\t\t\t\tlastWordEl.remove();\n\t\t\t\t\t\t\twholeWordEl.appendChild(lastWordEl);\n\t\t\t\t\t\t\twholeWordEl.appendChild(wordEl);\n\t\t\t\t\t\t\tmain.appendChild(wholeWordEl);\n\t\t\t\t\t\t\tlastWordEl = wholeWordEl;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlastWordEl = CJKEXP.test(word.word) ? null : wordEl;\n\t\t\t\t\t\tmain.appendChild(wordEl);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst wordEl =\n\t\t\t\t\t\treusableElements.pop() ?? document.createElement(\"span\");\n\t\t\t\t\twordEl.className = \"\";\n\t\t\t\t\twordEl.innerText = word.word;\n\t\t\t\t\tword.elements = [wordEl];\n\t\t\t\t\tword.elementAnimations.push(this.initFloatAnimation(word, wordEl));\n\t\t\t\t\tif (lastWordEl) {\n\t\t\t\t\t\tif (lastWordEl.childElementCount > 0) {\n\t\t\t\t\t\t\tlastWordEl.appendChild(wordEl);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst wholeWordEl =\n\t\t\t\t\t\t\t\treusableElements.pop() ?? document.createElement(\"span\");\n\t\t\t\t\t\t\twholeWordEl.className = \"\";\n\t\t\t\t\t\t\tlastWordEl.remove();\n\t\t\t\t\t\t\twholeWordEl.appendChild(lastWordEl);\n\t\t\t\t\t\t\twholeWordEl.appendChild(wordEl);\n\t\t\t\t\t\t\tmain.appendChild(wholeWordEl);\n\t\t\t\t\t\t\tlastWordEl = wholeWordEl;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlastWordEl = wordEl;\n\t\t\t\t\t\tmain.appendChild(wordEl);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (word.word.length > 0) {\n\t\t\t\tconst wordEl = reusableTextNodes.pop() ?? document.createTextNode(\" \");\n\t\t\t\tmain.appendChild(wordEl);\n\t\t\t\tlastWordEl = null;\n\t\t\t} else {\n\t\t\t\tlastWordEl = null;\n\t\t\t}\n\t\t});\n\t\ttrans.innerText = this.lyricLine.translatedLyric;\n\t\troman.innerText = this.lyricLine.romanLyric;\n\t}\n\tprivate initFloatAnimation(word: LyricWord, wordEl: HTMLSpanElement) {\n\t\tconst a = wordEl.animate(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\ttransform: \"translateY(0px)\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttransform: \"translateY(-3%)\",\n\t\t\t\t},\n\t\t\t],\n\t\t\t{\n\t\t\t\tduration: Math.max(1000, word.endTime - word.startTime),\n\t\t\t\tdelay: word.startTime - this.lyricLine.startTime,\n\t\t\t\tid: \"float-word\",\n\t\t\t\tcomposite: \"add\",\n\t\t\t\tfill: \"both\",\n\t\t\t},\n\t\t);\n\t\ta.pause();\n\t\treturn a;\n\t}\n\tprivate initEmphasizeAnimation(word: RealWord): Animation[] {\n\t\tconst delay = word.startTime - this.lyricLine.startTime;\n\t\tconst duration = word.endTime - word.startTime;\n\t\treturn word.elements.map((el, i, arr) => {\n\t\t\tif (i === 0) {\n\t\t\t\treturn this.initFloatAnimation(word, el);\n\t\t\t} else {\n\t\t\t\tconst a = el.animate(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\t\ttransform: \"translate3d(0, 0px, 0px)\",\n\t\t\t\t\t\t\tfilter: \"drop-shadow(0 0 0 var(--amll-lyric-line-color))\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toffset: 0.5,\n\t\t\t\t\t\t\ttransform: \"translate3d(0, -2%, 20px)\",\n\t\t\t\t\t\t\tfilter: \"drop-shadow(0 0 0.2rem var(--amll-lyric-line-color))\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\toffset: 1,\n\t\t\t\t\t\t\ttransform: \"translate3d(0, 0px, 0)\",\n\t\t\t\t\t\t\tfilter: \"drop-shadow(0 0 0 var(--amll-lyric-line-color))\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t{\n\t\t\t\t\t\tduration: Math.max(1000, word.endTime - word.startTime),\n\t\t\t\t\t\tdelay: delay + (duration / (arr.length - 1)) * (i - 1),\n\t\t\t\t\t\tid: \"glow-word\",\n\t\t\t\t\t\titerations: 1,\n\t\t\t\t\t\tcomposite: \"replace\",\n\t\t\t\t\t\tfill: \"both\",\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\ta.pause();\n\t\t\t\treturn a;\n\t\t\t}\n\t\t});\n\t}\n\tupdateMaskImage() {\n\t\tif (this._hide) {\n\t\t\tthis.element.style.display = \"\";\n\t\t\tthis.element.style.visibility = \"hidden\";\n\t\t}\n\t\tthis.splittedWords.forEach((word) => {\n\t\t\tconst wordEl = word.elements[0];\n\t\t\tif (wordEl) {\n\t\t\t\tword.width = wordEl.clientWidth;\n\t\t\t\tword.height = wordEl.clientHeight;\n\t\t\t\tconst [maskImage, _widthInTotal, totalAspect] = generateFadeGradient(\n\t\t\t\t\t16 / word.width,\n\t\t\t\t\t\"rgba(0,0,0,0.75)\",\n\t\t\t\t\t\"rgba(0,0,0,0.25)\",\n\t\t\t\t);\n\t\t\t\tconst totalAspectStr = `${totalAspect * 100}% 100%`;\n\t\t\t\tif (this.lyricPlayer.supportMaskImage) {\n\t\t\t\t\twordEl.style.maskImage = maskImage;\n\t\t\t\t\twordEl.style.maskOrigin = \"left\";\n\t\t\t\t\twordEl.style.maskSize = totalAspectStr;\n\t\t\t\t} else {\n\t\t\t\t\twordEl.style.webkitMaskImage = maskImage;\n\t\t\t\t\twordEl.style.webkitMaskOrigin = \"left\";\n\t\t\t\t\twordEl.style.webkitMaskSize = totalAspectStr;\n\t\t\t\t}\n\t\t\t\tconst w = word.width + 16;\n\t\t\t\tconst maskPos = `clamp(${-w}px,calc(${-w}px + (var(--amll-player-time) - ${\n\t\t\t\t\tword.startTime\n\t\t\t\t})*${\n\t\t\t\t\tw / Math.abs(word.endTime - word.startTime)\n\t\t\t\t}px),0px) 0px, left top`;\n\t\t\t\t// const maskPos = `clamp(0px,${w}px,${w}px) 0px, left top`;\n\t\t\t\twordEl.style.maskPosition = maskPos;\n\t\t\t\twordEl.style.webkitMaskPosition = maskPos;\n\t\t\t}\n\t\t});\n\t\tif (this._hide) {\n\t\t\tthis.element.style.display = \"none\";\n\t\t\tthis.element.style.visibility = \"\";\n\t\t}\n\t}\n\tgetElement() {\n\t\treturn this.element;\n\t}\n\tsetTransform(\n\t\tleft: number = this.left,\n\t\ttop: number = this.top,\n\t\tscale: number = this.scale,\n\t\topacity = 1,\n\t\tblur = 0,\n\t\tforce = false,\n\t\tdelay = 0,\n\t) {\n\t\tthis.left = left;\n\t\tthis.top = top;\n\t\tthis.scale = scale;\n\t\tthis.delay = (delay * 1000) | 0;\n\t\tconst main = this.element.children[0] as HTMLDivElement;\n\t\tmain.style.opacity = `${opacity}`;\n\t\tif (force || !this.lyricPlayer.getEnableSpring()) {\n\t\t\tthis.blur = Math.min(32, blur);\n\t\t\tif (force)\n\t\t\t\tthis.element.classList.add(\n\t\t\t\t\tthis.lyricPlayer.style.classes.tmpDisableTransition,\n\t\t\t\t);\n\t\t\tthis.lineTransforms.posX.setPosition(left);\n\t\t\tthis.lineTransforms.posY.setPosition(top);\n\t\t\tthis.lineTransforms.scale.setPosition(scale);\n\t\t\tif (!this.lyricPlayer.getEnableSpring()) this.show();\n\t\t\telse this.rebuildStyle();\n\t\t\tif (force)\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\tthis.element.classList.remove(\n\t\t\t\t\t\tthis.lyricPlayer.style.classes.tmpDisableTransition,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t} else {\n\t\t\tthis.lineTransforms.posX.setTargetPosition(left, delay);\n\t\t\tthis.lineTransforms.posY.setTargetPosition(top, delay);\n\t\t\tthis.lineTransforms.scale.setTargetPosition(scale);\n\t\t\tif (this.blur !== Math.min(32, blur)) {\n\t\t\t\tthis.blur = Math.min(32, blur);\n\t\t\t\tthis.element.style.filter = `blur(${Math.min(32, blur)}px)`;\n\t\t\t}\n\t\t}\n\t}\n\tupdate(delta = 0) {\n\t\tif (!this.lyricPlayer.getEnableSpring()) return;\n\t\tthis.lineTransforms.posX.update(delta);\n\t\tthis.lineTransforms.posY.update(delta);\n\t\tthis.lineTransforms.scale.update(delta);\n\t\tif (this.isInSight) {\n\t\t\tthis.show();\n\t\t} else {\n\t\t\tthis.hide();\n\t\t}\n\t}\n\tget isInSight() {\n\t\tconst l = this.lineTransforms.posX.getCurrentPosition();\n\t\tconst t = this.lineTransforms.posY.getCurrentPosition();\n\t\tconst r = l + this.lineSize[0];\n\t\tconst b = t + this.lineSize[1];\n\t\tconst pl = this.lyricPlayer.pos[0];\n\t\tconst pt = this.lyricPlayer.pos[1];\n\t\tconst pr = this.lyricPlayer.pos[0] + this.lyricPlayer.size[0];\n\t\tconst pb = this.lyricPlayer.pos[1] + this.lyricPlayer.size[1];\n\t\treturn !(l > pr || t > pb || r < pl || b < pt);\n\t}\n\tdispose(): void {\n\t\tthis.element.remove();\n\t}\n}\n","/**\n * @fileoverview\n * 一个播放歌词的组件\n * @author SteveXMH\n */\n\nimport type { Disposable, HasElement, LyricLine } from \"../interfaces\";\nimport { eqSet } from \"../utils/eq-set\";\nimport { SpringParams } from \"../utils/spring\";\nimport { InterludeDots } from \"./interlude-dots\";\nimport { LyricLineEl, shouldEmphasize } from \"./lyric-line\";\nimport { create } from \"jss\";\nimport preset from \"jss-preset-default\";\n\nconst jss = create(preset());\n\n/**\n * 歌词播放组件,本框架的核心组件\n *\n * 尽可能贴切 Apple Music for iPad 的歌词效果设计,且做了力所能及的优化措施\n */\nexport class LyricPlayer extends EventTarget implements HasElement, Disposable {\n\tprivate element: HTMLElement = document.createElement(\"div\");\n\tprivate currentTime = 0;\n\tprivate lyricLines: LyricLine[] = [];\n\tprivate processedLines: LyricLine[] = [];\n\tprivate lyricLinesEl: LyricLineEl[] = [];\n\tprivate lyricLinesSize: Map<LyricLineEl, [number, number]> = new Map();\n\tprivate hotLines: Set<number> = new Set();\n\tprivate bufferedLines: Set<number> = new Set();\n\tprivate scrollToIndex = 0;\n\tprivate resizeObserver: ResizeObserver = new ResizeObserver((e) => {\n\t\tconst rect = e[0].contentRect;\n\t\tthis.size[0] = rect.width;\n\t\tthis.size[1] = rect.height;\n\t\tthis.pos[0] = rect.left;\n\t\tthis.pos[1] = rect.top;\n\t\tthis.rebuildStyle();\n\t\tthis.calcLayout(true);\n\t\tthis.lyricLinesEl.forEach((el) => el.updateMaskImage());\n\t});\n\tprivate posXSpringParams: Partial<SpringParams> = {\n\t\tmass: 1,\n\t\tdamping: 10,\n\t\tstiffness: 100,\n\t};\n\tprivate posYSpringParams: Partial<SpringParams> = {\n\t\tmass: 1,\n\t\tdamping: 15,\n\t\tstiffness: 100,\n\t};\n\tprivate scaleSpringParams: Partial<SpringParams> = {\n\t\tmass: 1,\n\t\tdamping: 20,\n\t\tstiffness: 100,\n\t};\n\tprivate enableBlur = true;\n\tprivate interludeDots: InterludeDots;\n\tprivate interludeDotsSize: [number, number] = [0, 0];\n\treadonly supportPlusLighter = CSS.supports(\"mix-blend-mode\", \"plus-lighter\");\n\treadonly supportMaskImage = CSS.supports(\"mask-image\", \"none\");\n\tprivate disableSpring = false;\n\tprivate alignAnchor: \"top\" | \"bottom\" | number = 0.5;\n\treadonly size: [number, number] = [0, 0];\n\treadonly pos: [number, number] = [0, 0];\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tsetEnableSpring(enable = true) {\n\t\tthis.disableSpring = !enable;\n\t\tif (enable) {\n\t\t\tthis.element.classList.remove(this.style.classes.disableSpring);\n\t\t} else {\n\t\t\tthis.element.classList.add(this.style.classes.disableSpring);\n\t\t}\n\t\tthis.calcLayout(true);\n\t}\n\t/**\n\t * 获取当前是否启用了物理弹簧\n\t * @returns 是否启用物理弹簧\n\t */\n\tgetEnableSpring() {\n\t\treturn !this.disableSpring;\n\t}\n\tpublic readonly style = jss.createStyleSheet({\n\t\tlyricPlayer: {\n\t\t\tuserSelect: \"none\",\n\t\t\tpadding: \"1rem\",\n\t\t\tboxSizing: \"border-box\",\n\t\t\tfontSize: \"max(5vh, 12px)\",\n\t\t\tfontWeight: \"bold\",\n\t\t\twidth: \"100%\",\n\t\t\theight: \"100%\",\n\t\t\toverflow: \"hidden\",\n\t\t\tmaxWidth: \"100%\",\n\t\t\tmaxHeight: \"100%\",\n\t\t\tzIndex: 1,\n\t\t\tcolor: \"var(--amll-lyric-line-color)\",\n\t\t\tmixBlendMode: \"plus-lighter\",\n\t\t\tcontain: \"strict\",\n\t\t},\n\t\tlyricLine: {\n\t\t\tposition: \"absolute\",\n\t\t\ttransformOrigin: \"left\",\n\t\t\tmaxWidth: \"65%\",\n\t\t\tpadding: \"max(2vh, 1rem) 1rem\",\n\t\t\tcontain: \"content\",\n\t\t\ttransition: \"filter 0.25s\",\n\t\t\tmargin: \"max(2vh, 1rem) -1rem\",\n\t\t},\n\t\t\"@media (max-width: 1024px)\": {\n\t\t\tlyricLine: {\n\t\t\t\tmaxWidth: \"75%\",\n\t\t\t\tpadding: \"max(1vh, 1rem) 1rem\",\n\t\t\t\tmargin: \"0 -1rem\",\n\t\t\t},\n\t\t},\n\t\tlyricDuetLine: {\n\t\t\ttextAlign: \"right\",\n\t\t\ttransformOrigin: \"right\",\n\t\t},\n\t\tlyricBgLine: {\n\t\t\topacity: 0,\n\t\t\tfontSize: \"max(50%, 10px)\",\n\t\t\ttransition: \"opacity 0.25s\",\n\t\t\t\"&.active\": {\n\t\t\t\ttransition: \"opacity 0.25s 0.25s\",\n\t\t\t\topacity: 1,\n\t\t\t},\n\t\t},\n\t\tlyricMainLine: {\n\t\t\ttransition: \"opacity 0.3s 0.25s\",\n\t\t\tmargin: \"-1rem\",\n\t\t\tpadding: \"1rem\",\n\t\t\t\"& span\": {\n\t\t\t\tdisplay: \"inline-block\",\n\t\t\t\tmargin: \"-1rem\",\n\t\t\t\tpadding: \"1rem\",\n\t\t\t},\n\t\t\t\"& > span\": {\n\t\t\t\twhiteSpace: \"pre-wrap\",\n\t\t\t\twordBreak: \"keep-all\",\n\t\t\t\tmaxLines: \"1\",\n\t\t\t\t\"&.emphasize\": {\n\t\t\t\t\tmargin: \"-1rem\",\n\t\t\t\t\tpadding: \"1rem\",\n\t\t\t\t\ttransformStyle: \"preserve-3d\",\n\t\t\t\t\tperspective: \"50vw\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tlyricSubLine: {\n\t\t\tfontSize: \"max(50%, 10px)\",\n\t\t\topacity: 0.5,\n\t\t},\n\t\tdisableSpring: {\n\t\t\t\"& > *\": {\n\t\t\t\ttransition: \"filter 0.25s, transform 0.5s\",\n\t\t\t},\n\t\t},\n\t\tinterludeDots: {\n\t\t\theight: \"min(1rem,2.5vh)\",\n\t\t\ttransformOrigin: \"center\",\n\t\t\twidth: \"fit-content\",\n\t\t\tpadding: \"2.5% 0\",\n\t\t\tposition: \"absolute\",\n\t\t\tdisplay: \"flex\",\n\t\t\tgap: \"0.5rem\",\n\t\t\t\"& > *\": {\n\t\t\t\twidth: \"100%\",\n\t\t\t\tdisplay: \"inline-block\",\n\t\t\t\tborderRadius: \"50%\",\n\t\t\t\taspectRatio: \"1 / 1\",\n\t\t\t\tbackgroundColor: \"var(--amll-lyric-line-color)\",\n\t\t\t\tmarginRight: \"4px\",\n\t\t\t},\n\t\t\t\"&.duet\": {\n\t\t\t\tright: \"1rem\",\n\t\t\t\ttransformOrigin: \"center\",\n\t\t\t},\n\t\t},\n\t\t\"@supports (mix-blend-mode: plus-lighter)\": {\n\t\t\tlyricSubLine: {\n\t\t\t\topacity: 0.3,\n\t\t\t},\n\t\t},\n\t\ttmpDisableTransition: {\n\t\t\ttransition: \"none !important\",\n\t\t},\n\t});\n\tprivate onPageShow = () => {\n\t\tthis.calcLayout(true);\n\t};\n\tconstructor() {\n\t\tsuper();\n\t\tthis.interludeDots = new InterludeDots(this);\n\t\tthis.element.setAttribute(\"class\", this.style.classes.lyricPlayer);\n\t\tif (this.disableSpring) {\n\t\t\tthis.element.classList.add(this.style.classes.disableSpring);\n\t\t}\n\t\tthis.rebuildStyle();\n\t\tthis.resizeObserver.observe(this.element);\n\t\tthis.element.appendChild(this.interludeDots.getElement());\n\t\tthis.style.attach();\n\t\tthis.interludeDots.setTransform(0, 200);\n\t\twindow.addEventListener(\"pageshow\", this.onPageShow);\n\t}\n\t/**\n\t * 获取当前播放时间里是否处于间奏区间\n\t * 如果是则会返回单位为毫秒的始末时间\n\t * 否则返回 undefined\n\t *\n\t * 这个只允许内部调用\n\t * @returns [开始时间,结束时间] 或 undefined 如果不处于间奏区间\n\t */\n\tgetCurrentInterlude(): [number, number] | undefined {\n\t\tif (this.bufferedLines.size > 0) return undefined;\n\t\tconst currentTime = this.currentTime + 20;\n\t\tconst i = this.scrollToIndex;\n\t\tif (i === 0) {\n\t\t\tif (this.processedLines[0]?.startTime) {\n\t\t\t\tif (this.processedLines[0].startTime > currentTime) {\n\t\t\t\t\treturn [0, this.processedLines[0].startTime];\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tthis.processedLines[i]?.endTime &&\n\t\t\tthis.processedLines[i + 1]?.startTime\n\t\t) {\n\t\t\tif (\n\t\t\t\tthis.processedLines[i + 1].startTime > currentTime &&\n\t\t\t\tthis.processedLines[i].endTime < currentTime\n\t\t\t) {\n\t\t\t\treturn [\n\t\t\t\t\tthis.processedLines[i].endTime,\n\t\t\t\t\tthis.processedLines[i + 1].startTime,\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\t/**\n\t * 重建样式\n\t *\n\t * 这个只允许内部调用\n\t */\n\trebuildStyle() {\n\t\tlet style = \"\";\n\t\tstyle += \"--amll-lyric-player-width:\";\n\t\tstyle += this.element.clientWidth;\n\t\tstyle += \"px;\";\n\t\tstyle += \"--amll-lyric-player-height:\";\n\t\tstyle += this.element.clientHeight;\n\t\tstyle += \"px;\";\n\t\tstyle += \"--amll-lyric-line-color:\";\n\t\tstyle += \"#FFFFFF;\";\n\t\tstyle += \"--amll-player-time:\";\n\t\tstyle += this.currentTime;\n\t\tstyle += \";\";\n\t\tthis.element.setAttribute(\"style\", style);\n\t}\n\t/**\n\t * 设置是否启用歌词行的模糊效果\n\t * @param enable 是否启用\n\t */\n\tsetEnableBlur(enable: boolean) {\n\t\tif (this.enableBlur === enable) return;\n\t\tthis.enableBlur = enable;\n\t\tthis.calcLayout();\n\t}\n\t/**\n\t * 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误\n\t * @param lines 歌词数组\n\t */\n\tsetLyricLines(lines: LyricLine[]) {\n\t\tthis.lyricLines = lines;\n\t\tconst timeOffset = 750;\n\t\tthis.processedLines = lines.map((line, i, lines) => {\n\t\t\tif (line.isBG)\n\t\t\t\treturn {\n\t\t\t\t\t...line,\n\t\t\t\t};\n\t\t\telse {\n\t\t\t\tconst lastLine = lines[i - 1];\n\t\t\t\tconst pastLine = lines[i - 2];\n\t\t\t\tif (lastLine?.isBG && pastLine) {\n\t\t\t\t\tif (pastLine.endTime < line.startTime) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...line,\n\t\t\t\t\t\t\tstartTime:\n\t\t\t\t\t\t\t\tMath.max(pastLine.endTime, line.startTime - timeOffset) ||\n\t\t\t\t\t\t\t\tline.startTime,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t} else if (lastLine?.endTime) {\n\t\t\t\t\tif (lastLine.endTime < line.startTime) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...line,\n\t\t\t\t\t\t\tstartTime:\n\t\t\t\t\t\t\t\tMath.max(lastLine?.endTime, line.startTime - timeOffset) ||\n\t\t\t\t\t\t\t\tline.startTime,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\t...line,\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\t\tthis.processedLines.forEach((line, i, lines) => {\n\t\t\tconst nextLine = lines[i + 1];\n\t\t\tconst lastWord = line.words[line.words.length - 1];\n\t\t\tif (lastWord && shouldEmphasize(lastWord)) {\n\t\t\t\tif (nextLine) {\n\t\t\t\t\tif (nextLine.startTime > line.endTime) {\n\t\t\t\t\t\tline.endTime = Math.min(line.endTime + 1500, nextLine.startTime);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tline.endTime = line.endTime + 1500;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.processedLines.forEach((line, i, lines) => {\n\t\t\tif (line.isBG) return;\n\t\t\tconst nextLine = lines[i + 1];\n\t\t\tif (nextLine?.isBG) {\n\t\t\t\tnextLine.startTime = Math.min(nextLine.startTime, line.startTime);\n\t\t\t}\n\t\t});\n\t\tthis.lyricLinesEl.forEach((el) => el.dispose());\n\t\tthis.lyricLinesEl = this.processedLines.map(\n\t\t\t(line) => new LyricLineEl(this, line),\n\t\t);\n\t\tthis.lyricLinesEl.forEach((el) => {\n\t\t\tthis.element.appendChild(el.getElement());\n\t\t\tel.updateMaskImage();\n\t\t});\n\t\tthis.setLinePosXSpringParams({});\n\t\tthis.setLinePosYSpringParams({});\n\t\tthis.setLineScaleSpringParams({});\n\t\tthis.setCurrentTime(0, true);\n\t\tthis.calcLayout(true);\n\t}\n\t/**\n\t * 重新布局定位歌词行的位置,调用完成后再逐帧调用 `update`\n\t * 函数即可让歌词通过动画移动到目标位置。\n\t *\n\t * 此函数还有一个 `reflow` 参数,用于指定是否需要重新计算布局\n\t *\n\t * 因为计算布局必定会导致浏览器重排布局,所以会大幅度影响流畅度和性能,故请只在以下情况下将其设置为 true:\n\t *\n\t * 1. 歌词页面大小发生改变时(这个组件会自行处理)\n\t * 2. 加载了新的歌词时(不论前后歌词是否完全一样)\n\t * 3. 用户自行跳转了歌曲播放位置(不论距离远近)\n\t *\n\t * @param reflow 是否进行重新布局(重新计算每行歌词大小)\n\t */\n\tcalcLayout(reflow = false) {\n\t\tif (reflow) {\n\t\t\tthis.lyricLinesEl.forEach((el) => {\n\t\t\t\tconst size: [number, number] = el.measureSize();\n\t\t\t\tthis.lyricLinesSize.set(el, size);\n\t\t\t\tel.lineSize = size;\n\t\t\t});\n\t\t\tthis.interludeDotsSize[0] = this.interludeDots.getElement().clientWidth;\n\t\t\tthis.interludeDotsSize[1] = this.interludeDots.getElement().clientHeight;\n\t\t}\n\t\tconst SCALE_ASPECT = 0.95;\n\t\tconst scrollOffset = this.lyricLinesEl\n\t\t\t.slice(0, this.scrollToIndex)\n\t\t\t.reduce(\n\t\t\t\t(acc, el) =>\n\t\t\t\t\tacc + (el.getLine().isBG ? 0 : this.lyricLinesSize.get(el)?.[1] ?? 0),\n\t\t\t\t0,\n\t\t\t);\n\t\tlet curPos = -scrollOffset;\n\t\tif (this.alignAnchor === \"bottom\") {\n\t\t\tcurPos += this.element.clientHeight / 2;\n\t\t\tconst curLine = this.lyricLinesEl[this.scrollToIndex];\n\t\t\tif (curLine) {\n\t\t\t\tconst lineHeight = this.lyricLinesSize.get(curLine)?.[1] ?? 0;\n\t\t\t\tcurPos -= lineHeight / 2;\n\t\t\t}\n\t\t} else if (typeof this.alignAnchor === \"number\") {\n\t\t\tcurPos += this.element.clientHeight * this.alignAnchor;\n\t\t\tconst curLine = this.lyricLinesEl[this.scrollToIndex];\n\t\t\tif (curLine) {\n\t\t\t\tconst lineHeight = this.lyricLinesSize.get(curLine)?.[1] ?? 0;\n\t\t\t\tcurPos -= lineHeight / 2;\n\t\t\t}\n\t\t}\n\t\tconst interlude =\n\t\t\tthis.currentTime === 0 ? undefined : this.getCurrentInterlude();\n\t\tlet interludeDuration = 0;\n\t\tif (interlude) {\n\t\t\tinterludeDuration = interlude[1] - interlude[0];\n\t\t\tif (interludeDuration >= 5000) {\n\t\t\t\tconst nextLine =\n\t\t\t\t\tthis.currentTime === 0\n\t\t\t\t\t\t? this.lyricLinesEl[0]\n\t\t\t\t\t\t: this.lyricLinesEl[this.scrollToIndex + 1];\n\t\t\t\tif (nextLine) {\n\t\t\t\t\tcurPos -= this.lyricLinesSize.get(nextLine)?.[1] ?? 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst latestIndex = Math.max(...this.bufferedLines);\n\t\tlet delay = 0;\n\t\tthis.lyricLinesEl.forEach((el, i) => {\n\t\t\tconst hasBuffered = this.bufferedLines.has(i);\n\t\t\tconst isActive =\n\t\t\t\thasBuffered || (i >= this.scrollToIndex && i < latestIndex);\n\t\t\tconst line = el.getLine();\n\t\t\tlet left = 0;\n\t\t\tif (line.isDuet) {\n\t\t\t\tleft = this.size[0] - (this.lyricLinesSize.get(el)?.[0] ?? 0);\n\t\t\t}\n\t\t\tif (i === this.scrollToIndex + 1 && interludeDuration >= 5000) {\n\t\t\t\tthis.interludeDots.setTransform(0, curPos);\n\t\t\t\tthis.interludeDots.setInterlude(this.getCurrentInterlude());\n\t\t\t\tcurPos += this.interludeDotsSize[1];\n\t\t\t}\n\t\t\tel.setTransform(\n\t\t\t\tleft,\n\t\t\t\tcurPos,\n\t\t\t\tisActive ? 1 : SCALE_ASPECT,\n\t\t\t\thasBuffered ? 1 : 1 / 3,\n\t\t\t\tthis.enableBlur\n\t\t\t\t\t? 3 *\n\t\t\t\t\t (isActive\n\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t: 1 +\n\t\t\t\t\t\t\t (i < this.scrollToIndex\n\t\t\t\t\t\t\t\t\t? Math.abs(this.scrollToIndex - i)\n\t\t\t\t\t\t\t\t\t: Math.abs(i - Math.max(this.scrollToIndex, latestIndex))))\n\t\t\t\t\t: 0,\n\t\t\t\treflow,\n\t\t\t\tdelay,\n\t\t\t);\n\t\t\tif (line.isBG && isActive) {\n\t\t\t\tcurPos += this.lyricLinesSize.get(el)?.[1] ?? 0;\n\t\t\t} else if (!line.isBG) {\n\t\t\t\tcurPos += this.lyricLinesSize.get(el)?.[1] ?? 0;\n\t\t\t}\n\t\t\tif (curPos >= 0) {\n\t\t\t\tdelay += 0.05;\n\t\t\t}\n\t\t});\n\t}\n\t/**\n\t * 获取当前歌词的播放位置\n\t *\n\t * 一般和最后调用 `setCurrentTime` 给予的参数一样\n\t * @returns 当前播放位置\n\t */\n\tgetCurrentTime() {\n\t\treturn this.currentTime;\n\t}\n\t/**\n\t * 获取当前歌词数组\n\t *\n\t * 一般和最后调用 `setLyricLines` 给予的参数一样\n\t * @returns 当前歌词数组\n\t */\n\tgetLyricLines() {\n\t\treturn this.lyricLines;\n\t}\n\tgetElement(): HTMLElement {\n\t\treturn this.element;\n\t}\n\t/**\n\t * 设置歌词行的对齐方式,默认为 `top`\n\t *\n\t * - 设置成 `top` 的话歌词将会向组件顶部对齐\n\t * - 设置成 `bottom` 的话歌词将会向组件底部对齐\n\t * - 设置成 [0.0-1.0] 之间任意数字的话则会根据当前组件高度从顶部向下位移为对齐位置垂直居中对齐\n\t * @param alignAnchor 歌词行对齐方式,详情见函数说明\n\t */\n\tsetAlignAnchor(alignAnchor: \"top\" | \"bottom\" | number) {\n\t\tthis.alignAnchor = alignAnchor;\n\t}\n\t/**\n\t * 设置当前播放进度,单位为毫秒且**必须是整数**,此时将会更新内部的歌词进度信息\n\t * 内部会根据调用间隔和播放进度自动决定如何滚动和显示歌词,所以这个的调用频率越快越准确越好\n\t *\n\t * 调用完成后,可以每帧调用 `update` 函数来执行歌词动画效果\n\t * @param time 当前播放进度,单位为毫秒\n\t */\n\tsetCurrentTime(time: number, isSeek = false) {\n\t\t// 我在这里定义了歌词的选择状态:\n\t\t// 普通行:当前不处于时间范围内的歌词行\n\t\t// 热行:当前绝对处于播放时间内的歌词行,且一般会被立刻加入到缓冲行中\n\t\t// 缓冲行:一般处于播放时间后的歌词行,会因为当前播放状态的缘故推迟解除状态\n\n\t\t// 然后我们需要让歌词行为如下:\n\t\t// 如果当前仍有缓冲行的情况下加入新热行,则不会解除当前缓冲行,且也不会修改当前滚动位置\n\t\t// 如果当前所有缓冲行都将被删除且没有新热行加入,则删除所有缓冲行,且也不会修改当前滚动位置\n\t\t// 如果当前所有缓冲行都将被删除且有新热行加入,则删除所有缓冲行并加入新热行作为缓冲行,然后修改当前滚动位置\n\t\tthis.currentTime = time;\n\t\tthis.element.style.setProperty(\"--amll-player-time\", `${time}`);\n\t\tconst removedHotIds = new Set<number>();\n\t\tconst removedIds = new Set<number>();\n\t\tconst addedIds = new Set<number>();\n\n\t\t// 先检索当前已经超出时间范围的缓冲行,列入待删除集内\n\t\tthis.hotLines.forEach((lastHotId) => {\n\t\t\tconst line = this.processedLines[lastHotId];\n\t\t\tif (line.isBG) return;\n\t\t\tif (line) {\n\t\t\t\tconst nextLine = this.processedLines[lastHotId + 1];\n\t\t\t\tif (nextLine?.isBG) {\n\t\t\t\t\tconst startTime = Math.min(line.startTime, nextLine?.startTime);\n\t\t\t\t\tconst endTime = Math.max(line.endTime, nextLine?.endTime);\n\t\t\t\t\tif (startTime > time || endTime <= time) {\n\t\t\t\t\t\tthis.hotLines.delete(lastHotId);\n\t\t\t\t\t\tremovedHotIds.add(lastHotId);\n\t\t\t\t\t\tthis.hotLines.delete(lastHotId + 1);\n\t\t\t\t\t\tremovedHotIds.add(lastHotId + 1);\n\t\t\t\t\t\tif (isSeek) {\n\t\t\t\t\t\t\tthis.lyricLinesEl[lastHotId].disable();\n\t\t\t\t\t\t\tthis.lyricLinesEl[lastHotId + 1].disable();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (line.startTime > time || line.endTime <= time) {\n\t\t\t\t\tthis.hotLines.delete(lastHotId);\n\t\t\t\t\tremovedHotIds.add(lastHotId);\n\t\t\t\t\tif (isSeek) this.lyricLinesEl[lastHotId].disable();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.hotLines.delete(lastHotId);\n\t\t\t\tremovedHotIds.add(lastHotId);\n\t\t\t\tif (isSeek) this.lyricLinesEl[lastHotId].disable();\n\t\t\t}\n\t\t});\n\t\tthis.processedLines.forEach((line, id, arr) => {\n\t\t\tif (!line.isBG && line.startTime <= time && line.endTime > time) {\n\t\t\t\tif (!this.hotLines.has(id)) {\n\t\t\t\t\tthis.hotLines.add(id);\n\t\t\t\t\taddedIds.add(id);\n\t\t\t\t\tif (isSeek) this.lyricLinesEl[id].enable();\n\t\t\t\t\tif (arr[id + 1]?.isBG) {\n\t\t\t\t\t\tthis.hotLines.add(id + 1);\n\t\t\t\t\t\taddedIds.add(id + 1);\n\t\t\t\t\t\tif (isSeek) this.lyricLinesEl[id + 1].enable();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.bufferedLines.forEach((v) => {\n\t\t\tif (!this.hotLines.has(v)) {\n\t\t\t\tremovedIds.add(v);\n\t\t\t\tif (isSeek) this.lyricLinesEl[v].disable();\n\t\t\t}\n\t\t});\n\t\tif (isSeek) {\n\t\t\tif (this.bufferedLines.size > 0) {\n\t\t\t\tthis.scrollToIndex = Math.min(...this.bufferedLines);\n\t\t\t} else {\n\t\t\t\tthis.scrollToIndex = this.processedLines.findIndex(\n\t\t\t\t\t(line) => line.startTime >= time,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.bufferedLines.clear();\n\t\t\tthis.hotLines.forEach((v) => this.bufferedLines.add(v));\n\t\t\tthis.calcLayout(true);\n\t\t} else if (removedIds.size > 0 || addedIds.size > 0) {\n\t\t\tif (removedIds.size === 0 && addedIds.size > 0) {\n\t\t\t\taddedIds.forEach((v) => {\n\t\t\t\t\tthis.bufferedLines.add(v);\n\t\t\t\t\tthis.lyricLinesEl[v].enable();\n\t\t\t\t});\n\t\t\t\tthis.scrollToIndex = Math.min(...this.bufferedLines);\n\t\t\t} else if (addedIds.size === 0 && removedIds.size > 0) {\n\t\t\t\tif (eqSet(removedIds, this.bufferedLines)) {\n\t\t\t\t\tthis.bufferedLines.forEach((v) => {\n\t\t\t\t\t\tif (!this.hotLines.has(v)) {\n\t\t\t\t\t\t\tthis.bufferedLines.delete(v);\n\t\t\t\t\t\t\tthis.lyricLinesEl[v].disable();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\taddedIds.forEach((v) => {\n\t\t\t\t\tthis.bufferedLines.add(v);\n\t\t\t\t\tthis.lyricLinesEl[v].enable();\n\t\t\t\t});\n\t\t\t\tremovedIds.forEach((v) => {\n\t\t\t\t\tthis.bufferedLines.delete(v);\n\t\t\t\t\tthis.lyricLinesEl[v].disable();\n\t\t\t\t});\n\t\t\t\tif (this.bufferedLines.size > 0)\n\t\t\t\t\tthis.scrollToIndex = Math.min(...this.bufferedLines);\n\t\t\t}\n\t\t\tthis.calcLayout();\n\t\t}\n\t}\n\t/**\n\t * 更新动画,这个函数应该被逐帧调用或者在以下情况下调用一次:\n\t *\n\t * 1. 刚刚调用完设置歌词函数的时候\n\t * @param delta 距离上一次被调用到现在的时长,单位为毫秒(可为浮点数)\n\t */\n\tupdate(delta = 0) {\n\t\tconst deltaS = delta / 1000;\n\t\tthis.interludeDots.update(delta);\n\t\tthis.lyricLinesEl.forEach((line) => line.update(deltaS));\n\t}\n\t/**\n\t * 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tsetLinePosXSpringParams(params: Partial<SpringParams>) {\n\t\tthis.posXSpringParams = {\n\t\t\t...this.posXSpringParams,\n\t\t\t...params,\n\t\t};\n\t\tthis.lyricLinesEl.forEach((line) =>\n\t\t\tline.lineTransforms.posX.updateParams(this.posXSpringParams),\n\t\t);\n\t}\n\t/**\n\t * 设置所有歌词行在纵坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tsetLinePosYSpringParams(params: Partial<SpringParams>) {\n\t\tthis.posYSpringParams = {\n\t\t\t...this.posYSpringParams,\n\t\t\t...params,\n\t\t};\n\t\tthis.lyricLinesEl.forEach((line) =>\n\t\t\tline.lineTransforms.posY.updateParams(this.posYSpringParams),\n\t\t);\n\t}\n\t/**\n\t * 设置所有歌词行在缩放大小上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tsetLineScaleSpringParams(params: Partial<SpringParams>) {\n\t\tthis.scaleSpringParams = {\n\t\t\t...this.scaleSpringParams,\n\t\t\t...params,\n\t\t};\n\t\tthis.lyricLinesEl.forEach((line) =>\n\t\t\tline.lineTransforms.scale.updateParams(this.scaleSpringParams),\n\t\t);\n\t}\n\tdispose(): void {\n\t\tthis.element.remove();\n\t\tthis.resizeObserver.disconnect();\n\t\tthis.style.detach();\n\t\tthis.lyricLinesEl.forEach((el) => el.dispose());\n\t\twindow.removeEventListener(\"pageshow\", this.onPageShow);\n\t}\n}\n"],"names":["timeRegexp","parseTimespan","timeSpan","matches","hour","_a","min","_b","sec","_c","parseTTML","ttmlText","ttmlDoc","mainAgentId","agent","id","result","lineEl","line","curBGLine","wordNode","word","wordEl","role","bgLine","firstWord","lastWord","TimedContainer","Container","__publicField","PixiRenderer","canvas","delta","lastContainer","s1","s2","s3","s4","maxSize","bounds","Application","speed","scale","minBorder","c0","ColorMatrixFilter","c1","c2","BlurFilter","fps","albumUrl","tex","Texture","container","Sprite","BackgroundRender","eqSet","xs","ys","x","easeInOutBack","clamp","cur","max","InterludeDots","lyricPlayer","left","top","interlude","curStyle","interludeDuration","currentDuration","breatheDuration","globalOpacity","dot0Opacity","dot1Opacity","dot2Opacity","Spring","currentPosition","curV","solveSpring","getVelocity","targetPosition","params","delay","from","velocity","to","soft","stiffness","damping","mass","angular_frequency","leftover","t","damping_frequency","dfm","dm","derivative","f","CJKEXP","generateFadeGradient","width","bright","dark","totalAspect","widthInTotal","leftPos","shouldEmphasize","LyricLineEl","lyricLine","main","trans","roman","a","size","style","splited","reusableElements","reusableTextNodes","collectNodes","curNode","lastWordEl","c","charEl","wholeWordEl","duration","el","i","arr","maskImage","_widthInTotal","totalAspectStr","w","maskPos","opacity","blur","force","l","r","b","pl","pt","pr","pb","jss","create","preset","LyricPlayer","rect","enable","currentTime","lines","timeOffset","lastLine","pastLine","nextLine","reflow","SCALE_ASPECT","curPos","acc","curLine","lineHeight","latestIndex","hasBuffered","isActive","alignAnchor","time","isSeek","removedHotIds","removedIds","addedIds","lastHotId","startTime","endTime","v","deltaS"],"mappings":"ydAEMA,EACL,uEACD,SAASC,EAAcC,EAA0B,WAC1C,MAAAC,EAAUH,EAAW,KAAKE,CAAQ,EACxC,GAAIC,EAAS,CACZ,MAAMC,EAAO,SAAOC,EAAAF,EAAQ,SAAR,YAAAE,EAAgB,OAAQ,GAAG,EACzCC,EAAM,SAAOC,EAAAJ,EAAQ,SAAR,YAAAI,EAAgB,MAAO,GAAG,EACvCC,EAAM,SAAOC,EAAAN,EAAQ,SAAR,YAAAM,EAAgB,IAAI,QAAQ,IAAK,OAAQ,GAAG,EAC/D,OAAO,KAAK,OAAOL,EAAO,KAAOE,EAAM,GAAKE,GAAO,GAAI,CAAA,KAEjD,OAAA,IAAI,UAAU,YAAY,CAElC,CAEO,SAASE,EAAUC,EAA+B,CAExD,MAAMC,EADY,IAAI,YACiB,gBACtCD,EACA,iBAAA,EAGD,IAAIE,EAAc,KAElB,UAAWC,KAASF,EAAQ,iBAAiB,aAAa,EACzD,GAAIE,EAAM,aAAa,MAAM,IAAM,SAAU,CACtC,MAAAC,EAAKD,EAAM,aAAa,QAAQ,EAClCC,IACWF,EAAAE,EAEhB,CAGD,MAAMC,EAAsB,CAAA,EAE5B,UAAWC,KAAUL,EAAQ,iBAAiB,oBAAoB,EAAG,CACpE,MAAMM,EAAkB,CACvB,MAAO,CAAC,EACR,UAAWjB,EAAcgB,EAAO,aAAa,OAAO,GAAK,KAAK,EAC9D,QAAShB,EAAcgB,EAAO,aAAa,KAAK,GAAK,KAAK,EAC1D,gBAAiB,GACjB,WAAY,GACZ,KAAM,GACN,OAAQA,EAAO,aAAa,WAAW,IAAMJ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