宁静 发表于 2022-10-27 14:04

何日君再来 (前段) 演唱:周璇


<style>
      #papa {left: -270px;top:150px; width: 1400px; height: 711px; background: #ccc url('https://wj.zp68.com/lxx/yunhua/2022/09/16/0IF.gif') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
      #mplayer { position: absolute; left: 10px; bottom: 550px; }
      #btnwrap { display: block; fill: #ccc; cursor: pointer; }
      #btnwrap:hover { fill: orange; }
      #tmsg { fill: snow; stroke: gray; stroke-width: 1px; font: bold 1em sans-serif; }
      #lrc { position: absolute; bottom: 50px; left: 440px; font: bold 2em sans-serif; color: transparent; letter-spacing: 2px; background: linear-gradient(-90deg, darkgreen, orange, tomato) 100% 100% / 200% 200%; background-clip: text; -webkit-background-clip: text; }
      #xx {position: absolute; left: 0px;top: 0; width: 12px;offset-distance: 0;offset-path: path("M500 -60 Q300 80, 600 200 T300 340");animation: move 8s linear infinite;}
      #xx1 {position: absolute; left: -150px;top: -50px;width: 12px;offset-distance: 0;offset-path: path("M500 -60 Q300 80, 600 200 T400 440");animation: move 8s linear infinite;}
      #xx2 {position: absolute; left: -300px;top: 200px;width: 12px;offset-distance: 0;offset-path: path("M500 -60 Q300 80, 600 200 T350 340");animation: move 8s linear infinite;}

      #xxr3 {position: absolute; left: 70px; top: 20px;width: 12px;offset-distance: 0;offset-path: path("M500 -60 Q300 80, 600 200 T450 440");animation: move 8s linear infinite;}
      #xx4 {position: absolute; left: 150px;top: 30px;width: 12px;offset-distance: 0;offset-path: path("M500 -60 Q300 80, 600 200 T200 340");animation: move 8s linear infinite;}

    #xx5 {position: absolute; left: -20px;top: 50px; width: 12px;offset-distance: 0;offset-path: path("M500 -60 Q300 80, 600 200 T550 340");animation: move 8s linear infinite;}
      @keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
      @keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
      @keyframes move { to { offset-distance: 100%;} }
</style>

<div id="papa">
      <img id="xx" src="https://wj.zp68.com/lxx/yunhua/2022/09/16/dt.jpg" alt="" />
       <img id="xx1" src="https://wj.zp68.com/lxx/yunhua/2022/09/16/dt.jpg" alt="" />
       <img id="xx2" src="https://wj.zp68.com/lxx/yunhua/2022/09/16/dt.jpg" alt="" />
       <img id="xx3" src="https://wj.zp68.com/lxx/yunhua/2022/09/16/dt.jpg" alt="" />
       <img id="xx4" src="https://wj.zp68.com/lxx/yunhua/2022/09/16/dt.jpg" alt="" />
       <img id="xx5" src="https://wj.zp68.com/lxx/yunhua/2022/09/16/dt.jpg" alt="" />
      <div id="lrc">花潮lrc在线</div>
      <svg id="mplayer" width="120" height="120">
                <g id="mama" transform="rotate(-90, 60, 60)" style="cursor: pointer;">
                        <circle id="track" cx="60" cy="60" r="50" fill="none" stroke-width="10" stroke="rgba(255,255,255,0.65)" />
                        <circle id="prog" cx="60" cy="60" r="50" fill="none" stroke-width="6" stroke="rgba(57,54,81,0.85)" />
                </g>
                <g id="btnwrap">
                        <path id="btnplay" d="M 50 50,50 70,70, 60 z"></path>
                        <path id="btnpause" d="M 52 50,52 70,57 70,57 50,52 50 z M 60 50,60 70,65 70,65 50,60 50 z"></path>
                        <path d="M 57 50,60 50,60 70,57 70 z" fill="transparent" />
                </g>
                <path id="curPath" d="M 20 70 Q 60 0 100 70" fill="none" stroke="none"/>
                <path id="durPath" d="M 20 55 Q 60 110 100 55" fill="none" stroke="none"/>
                <g id="tmsg">
                        <text x="34" y="0"><textPath id="curMsg" xlink:href="#curPath" dominant-baseline="text-after-edge">00:00</textPath></text>
                        <text x="29" y="0"><textPath id="durMsg" xlink:href="#durPath" dominant-baseline="text-before-edge">00:00</textPath></text>
                </g>
      </svg>
</div>

<script>
let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
];
let mKey = 0, mSeek = false, mFlag = true;
let aud = new Audio();
let cc = {
      x: 1*track.getAttribute('cx'),
      y: 1*track.getAttribute('cy'),
      r: 1*track.getAttribute('r'),
      sw: 1*track.getAttribute('stroke-width'),
      len: track.getTotalLength(),
};

prog.style.strokeDasharray = prog.style.strokeDashoffset =cc.len;
aud.src = 'https://wj.zp68.com/lxx/yunhua/2022/09/16/hrjzl.mp3';
aud.autoplay = true;
aud.loop = true;

mama.onclick = (e) => {
      let deg = Math.atan2(e.offsetY - cc.y, e.offsetX - cc.x) * 180 / Math.PI;
      deg += (e.offsetX < cc.x && e.offsetY < cc.y) ? 450 : 90;
      aud.currentTime = aud.duration * deg / 360;
};

btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();

aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());

aud.addEventListener('timeupdate', () => {
      prog.style.strokeDashoffset = cc.len - cc.len * aud.currentTime / aud.duration;
      curMsg.textContent = toMin(aud.currentTime);
      durMsg.textContent = toMin(aud.duration);
      for(j=0; j<lrcAr.length; j++) {
                if(aud.currentTime >= lrcAr) {
                        if(mKey === j) showLrc(lrcAr);
                        else continue;
                }
      }
});

let mState = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none', lrc.style.animationPlayState = 'paused') : (btnplay.style.display = 'none', btnpause.style.display = 'block', lrc.style.animationPlayState = 'running');

let showLrc = (time) => {
      lrc.style.animation = (mFlag ? 'bgMove1 ' : 'bgMove2 ') + time + 's linear forwards';
      lrc.innerHTML = lrcAr;
      mKey += 1;
      mFlag = !mFlag;
}

let calcKey = () => {
      for(j = 0; j < lrcAr.length; j ++) {
                if(aud.currentTime <= lrcAr) {
                        mKey = j - 1;
                        break;
                }
      }
      if(mKey <0) mKey = 0;
      if(mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;
      let mtime = lrcAr - (aud.currentTime - lrcAr);
      showLrc(mtime);
}

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>
<br><br><br><br><br><br><br><br><br><br><br><br><br>

宁静 发表于 2022-10-27 14:05

老歌一首

沉默 发表于 2022-10-27 14:13

快速进来

沉默 发表于 2022-10-27 14:13

看看今天的运气

沉默 发表于 2022-10-27 14:16

还有2次,这里碰运气

沉默 发表于 2022-10-27 14:17

最后一次

楚心兰 发表于 2022-10-27 16:36

手机卡位

苏三月 发表于 2022-10-27 19:55

很美的城市夜景,那是萤火虫吗,太漂亮了{:10_402:}

苏三月 发表于 2022-10-27 19:57

这个同步做得挺好的,播放器也美美哒{:10_402:}

苏三月 发表于 2022-10-27 20:01

老歌多听两遍也好听,{:9005:}
页: [1] 2 3
查看完整版本: 何日君再来 (前段) 演唱:周璇