马黑黑 发表于 2022-8-2 21:04

加林森 发表于 2022-8-2 20:38
老黑请再来看看,这个效果怎么样?

这个脸上没长苔藓了,挺好

加林森 发表于 2022-8-2 21:05

本帖最后由 加林森 于 2022-9-11 19:43 编辑 <br /><br />马黑黑 发表于 2022-8-2 21:04
这个脸上没长苔藓了,挺好
哈哈,还不错啦。谢谢!

<style>
#papa { left: -214px; width: 1024px; height: 576px; background: gray url('https://pic.imgdb.cn/item/631d578416f2c2beb1d04830.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display:grid; place-items: center; user-select: none; overflow: hidden; position: relative; z-index: 1; }
#mplayer { position: absolute; bottom: 10px; width: fit-content; height: fit-content; display: flex; align-items: center; gap: 8px; z-index: 9; }
#btnwrap { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(to top right, lightblue, blue); cursor: pointer; }
#btnwrap:hover:#FFA500;   { background:   linear-gradient(to top right, snow, teal); }
#btnplay { width: 20px; height: 20px; background: #1E90FF; 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; }
#prog { width: 300px; height: 2px; background: #7FFF00;linear-gradient(to right,red,orange,blue,tomato) no-repeat; background-size: 1px 2px; cursor: pointer; position: relative;}
#prog::before { position: absolute; content: ''; top: -7px; width: inherit; height: 15px; }
#prog:hover::before { background: rgba(200,200,200,.15); }
#tmsg { font: normal 16px sans-serif; color:#FFA500; snow;}
#lrc { position: absolute; left: 20px; top: 20px; font: bold 1.5em sans-serif; color:#FFF8DC;skyblue; text-shadow: 2px 2px 2px #222; opacity: 1; animation: opa 1.5s infinite alternate; }
#wave { position: absolute; display:block; top: 0; }
@keyframes opa { to #F0E68C;{ opacity: .3;} }
</style>

<div id="papa">
      <div id="mplayer"><span id="btnwrap"><span id="btnplay"></span><span id="btnpause"></span></span><span id="prog"></span><span id="tmsg">00:00 | 00:00</span></div>
      <div id="lrc"></div>
      <svg id="wave" width="600" height="600"> <!-- 模拟电波 -->
                <circle cx="300" cy="300" r="0" fill="none" stroke="lightgreen" stroke-width="4">
                        <animate attributeName="r" begin="0s" from="0" to="290" dur="2s" repeatCount="indefinite"></animate>
                        <animate attributeName="stroke-opacity" begin="0s" from="0.5" to="0" dur="2s" repeatCount="indefinite"></animate>
                </circle>
                <circle cx="300" cy="300" r="0" fill="none" stroke="skyblue" stroke-width="3">
                        <animate attributeName="r" begin="0.5s" from="0" to="290" dur="2s" repeatCount="indefinite"></animate>
                        <animate attributeName="stroke-opacity" begin="0.5s" from="0.5" to="0" dur="2s" repeatCount="indefinite"></animate>
                </circle>
                <circle cx="300" cy="300" r="0" fill="none" stroke="lightblue" stroke-width="2">
                        <animate attributeName="r" begin="1s" from="0" to="290" dur="2s" repeatCount="indefinite"></animate>
                        <animate attributeName="stroke-opacity" begin="1s" from="0.5" to="0" dur="2s" repeatCount="indefinite"></animate>
                </circle>
                <circle cx="300" cy="300" r="0" fill="none" stroke="red" stroke-width="1">
                        <animate attributeName="r" begin="1.5s" from="0" to="290" dur="2s" repeatCount="indefinite"></animate>
                        <animate attributeName="stroke-opacity" begin="1.5s" from="0.5" to="0" dur="2s" repeatCount="indefinite"></animate>
                </circle>
      </svg>
</div>

<script>
let lrcAr = [
      ['0.00','D.C.'],
      ['240.00','感谢支持']
];
let aud = new Audio();
aud.src = 'https://music.163.com/song/media/outer/url?id=22770507.mp3';
aud.autoplay = true;
aud.loop = true;
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.addEventListener('pause', () => btnstate());
aud.addEventListener('play',() => btnstate());
aud.addEventListener('timeupdate', () => {
      prog.style.backgroundSize = prog.offsetWidth * aud.currentTime / aud.duration + 'px 2px';
      tmsg.innerText = toMin(aud.duration) + ' | ' + toMin(aud.currentTime);
      for(j=0; j<lrcAr.length; j++) {
                if(aud.currentTime >= lrcAr) lrc.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-8-2 21:07

加林森 发表于 2022-8-2 21:05
哈哈,还不错啦。谢谢!

过得去

加林森 发表于 2022-8-2 21:18

小辣椒 发表于 2022-8-2 20:44
队长主要找图的方法还是不清楚。。。。找的图本来就不是高清,像素低的图不要用

再提醒一下-----百度--- ...

小辣椒你再帮着我看看,这个算不算高清的?

加林森 发表于 2022-8-2 21:24

马黑黑 发表于 2022-8-2 21:07
过得去

我又换了一张真正高清的,你帮着看看。谢谢啦!

马黑黑 发表于 2022-8-2 21:51

加林森 发表于 2022-8-2 21:24
我又换了一张真正高清的,你帮着看看。谢谢啦!

做帖子所使用的图片,既要保证清晰度足够,又要体积合适,期间的取舍,颇有讲究。好的制作,1024*768的图片,有时候几十来kb就非常好了,这要看个人的制作经验。

加林森 发表于 2022-8-2 22:04

马黑黑 发表于 2022-8-2 21:51
做帖子所使用的图片,既要保证清晰度足够,又要体积合适,期间的取舍,颇有讲究。好的制作,1024*768的图 ...

嗯嗯。我以后会注意的。谢谢啦。猪头小队长!{:4_172:}
页: 1 [2]
查看完整版本: 《像风一样》- 薛之谦