|
<style> #beijing{ margin: 80px 0 0 calc(50% - 593px); width: 1024px; height: 640px; background:lightblue url(' https://pic.imgdb.cn/item/643a9c660d2dde577780ac68.jpg') center/cover no-repeat; box-shadow: 3px 3px 20px #000; overflow:hidden; user-select: none; position: relative; } #mplayer{ position: absolute; left: 342px; bottom: 40px; 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: #ccc linear-gradient(to top right,rgba(255,0,0,.75), rgba(0,255,0,.75)); cursor: pointer; } #btnwrap:hover{ background: #000 linear-gradient(to top right, rgba(255,0,0,.75),rgba(0,255,0,.75)); } #btnplay{ width: 20px; height: 20px; 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; } #prog{ width: 200px; height: 2px; background: #ccc linear-gradient(toright,red,orange,green,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(0,200,200,.15); } #tmsg{ font: normal 16px sans-serif; color: #FDFDBD; } #lrc{ position: absolute; left:392px; bottom: 80px; font: bold 1.3em sans-serif;color: #8CB9FB; text-shadow: 1px 1px 2px #000; text-align: center; z-index: 8;} #lrc:hover,#tmsg:hover { color: snow; } .txt3d{ position:absolute; left: 692px; top: 180px; width:380px; height:280px; line-height:32px; font-family:'微软雅黑', '黑体', sans-serif; font-size:1.6rem; color:#8CB9FB; letter-spacing:4px; text-shadow:1px 1px rgba(206,225,253,0.8),2px 2px rgba(206,225,253,0.7),3px 3pxrgba(206,225,253,0.6),4px 4px rgba(206,225,253,0.4); } </style> <divid="beijing"> <divid="mplayer"><span id="btnwrap"><spanid="btnplay"></span><span id="btnpause"></span></span><spanid="prog"></span><span id="tmsg">00:00 |00:00</span></div> <divid="lrc">lrc歌词</div> <pclass ="txt3d">菩萨蛮TO朝云暮雨<br><br> 暮春伤别离津渡,<br> 渡津离别伤春暮。<br> 朝露滴潇潇,<br> 潇潇滴露朝。<br><br> 雨霁归静女,<br> 女静归霁雨。<br> 云幻梦惊人,<br> 人惊梦幻云。<br> </div></div> <script> letlrcAr = [ ['0.00','巫山归梦'], ['280.00','音阙诗听'] ]; letaud = new Audio(); aud.src='https://music.163.com/song/media/outer/url?id=1996268501.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[j][0]) lrc.innerText = lrcAr[j][1]; } }); letbtnstate = () => aud.paused ? (btnplay.style.display = 'block',btnpause.style.display = 'none') : (btnplay.style.display= 'none', btnpause.style.display = 'block'); lettoMin = (val) => { if(!val) return '00:00'; val= Math.floor(val); letmin = parseInt(val / 60), sec = parseFloat(val % 60); if(min< 10) min = '0' + min; if(sec< 10) sec = '0' + sec; returnmin + ':' + sec; } </script>
|