支持桌面歌词拖动
This commit is contained in:
@@ -20,10 +20,11 @@ const createAnimation = (dom, duration) => new window.Animation(new window.Keyfr
|
||||
// https://jsfiddle.net/ceqpnbky/1/
|
||||
|
||||
module.exports = class FontPlayer {
|
||||
constructor({ lyric = '', className = '', lineModeClassName = '', shadowContent = false, shadowClassName = '' }) {
|
||||
constructor({ lyric = '', lineClassName = '', fontClassName = '', lineModeClassName = '', shadowContent = false, shadowClassName = '' }) {
|
||||
this.lyric = lyric
|
||||
|
||||
this.className = className
|
||||
this.lineClassName = lineClassName
|
||||
this.fontClassName = fontClassName
|
||||
this.lineModeClassName = lineModeClassName
|
||||
this.shadowContent = shadowContent
|
||||
this.shadowClassName = shadowClassName
|
||||
@@ -47,15 +48,18 @@ module.exports = class FontPlayer {
|
||||
|
||||
this.isLineMode = false
|
||||
|
||||
this.lineContent = document.createElement('div')
|
||||
this.lineContent.style = 'position:relative;'
|
||||
if (this.lineClassName) this.lineContent.classList.add(this.lineClassName)
|
||||
this.fontContent = document.createElement('div')
|
||||
this.fontContent.style = 'position:relative;'
|
||||
this.fontContent.className = this.className
|
||||
if (this.fontClassName) this.fontContent.classList.add(this.fontClassName)
|
||||
if (this.shadowContent) {
|
||||
this.fontShadowContent = document.createElement('div')
|
||||
this.fontShadowContent.style = 'position:absolute;top:0;left:0;width:100%;z-index:-1;'
|
||||
this.fontShadowContent.className = this.shadowClassName
|
||||
this.fontContent.appendChild(this.fontShadowContent)
|
||||
this.lineContent.appendChild(this.fontShadowContent)
|
||||
}
|
||||
this.lineContent.appendChild(this.fontContent)
|
||||
this._parseLyric()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user