加林森 发表于 2022-7-14 18:54

本帖最后由 加林森 于 2022-8-28 10:54 编辑 <br /><br />红影 发表于 2022-7-14 18:50
所以最好是能修复,省得再去装软件了。
就是啊。我现在整理得差不多了。

<style>
#papa { left: -214px; width: 1024px; height: 552px; background: gray url('https://pic.imgdb.cn/item/630acdd116f2c2beb118d4b9.jpg') no-repeat center/cover;box-shadow: 3px 3px 20px #000; position: relative; z-index: 1; }
#player { padding: 10px; position: absolute; right: 10px; top: 10px; width: fit-content; height: fit-content; display: flex; gap: 10px; flex-direction: column; }
#lrctext { font: bold 1.4em sans-serif; color: silver; text-shadow: 1px 1px 2px #000; user-select: none; transition: all 1.5s; }
#btnwrap { width: fit-content; height: fit-content; display: flex; gap: 8px; align-items: center; }
#btnmain { width: 36px; height: 36px; display: grid; place-items: center; background: rgba(0,0,0,.5); border-radius: 50%; cursor: pointer; transition: all 2s; }
#btnmain:hover { background: orange; }
#btnplay {width: 16px; height: 16px; background: #ccc; clip-path: polygon(0 0, 0% 100%, 100% 50%); }
#btnpause { width: 2px; height: 20px; border-style: solid; border-width: 0px 4px; border-color: transparent #eee; display: none; }
#prgline { width: 200px; height: 4px; background: #ccc linear-gradient(to right,red,orange,green,red) no-repeat center left; background-size: 1px 4px; cursor: pointer;}
#tmsg { font: normal 16px sans-serif; color: orange; user-select: none; text-shadow: 1px 1px 1px #000; transition: 1.5s; }
#tmsg:hover, #lrctext:hover { color: tomato; }
</style>

<div id="papa">
      <div id="player">
                <div id="lrctext">lrc歌词</div>
                <div id="btnwrap">
                        <span id="btnmain"><span id="btnplay"></span><span id="btnpause"></span></span>
                        <span id="prgline"></span><span id="tmsg">00:00 | 00:00</span>
                </div>
      </div>
</div>

<script>
let lrcAr = [
      ['00.00', '纯音乐 - 逃不开夏天'],
      ['220.00','谢谢欣赏']
];
let aud = new Audio();

aud.src = 'https://music.163.com/song/media/outer/url?id=1346528158.mp3';
aud.autoplay = true;
aud.loop = true;
btnmain.onclick = () => aud.paused ? aud.play() : aud.pause();
prgline.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prgline.offsetWidth;
aud.addEventListener('pause', () => btnstate());
aud.addEventListener('play',() => btnstate());
aud.addEventListener('timeupdate', () => {
      prgline.style.backgroundSize = prgline.offsetWidth * aud.currentTime / aud.duration + 'px 4px';
      tmsg.innerText = toMin(aud.duration) + ' | ' + toMin(aud.currentTime);
      for(j=0; j<lrcAr.length; j++) {
                if(aud.currentTime >= lrcAr) lrctext.innerText = lrcAr;
      }
});
let btnstate = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none') : (btnplay.style.display = 'none', btnpause.style.display = 'block');
let toMin = (val)=> {
      if (!val) return '00:00';
      val = Math.floor(val);
      let min = parseInt(val / 60), sec = parseFloat(val % 60);
      if(min < 10) min = '0' + min;
      if(sec < 10) sec = '0' + sec;
      return min + ':' + sec;
}
</script>

红影 发表于 2022-7-14 20:20

加林森 发表于 2022-7-14 18:54
就是啊。我现在整理得差不多了。

赶紧修吧,修好了,玩起来也方便。

加林森 发表于 2022-7-14 20:24

红影 发表于 2022-7-14 20:20
赶紧修吧,修好了,玩起来也方便。

已经搞定了。

加林森 发表于 2022-7-14 22:13

加林森 发表于 2022-7-14 09:21
谢谢樵歌啦。

自己再来欣赏!

樵歌 发表于 2022-7-16 09:20

加林森 发表于 2022-7-14 09:21
谢谢樵歌啦。

你我还用客气么{:4_190:}

加林森 发表于 2022-7-16 09:42

樵歌 发表于 2022-7-16 09:20
你我还用客气么

好的好的。
页: 1 2 [3]
查看完整版本: 《兰亭序(抖音纯享版)》- 纯音乐馆