亚伦影音工作室 发表于 2022-10-20 22:24

大哥的女人【马黑老师源码】

本帖最后由 亚伦影音工作室 于 2022-10-20 22:31 编辑 <br /><br /><style>
#papa { margin: 0px -214px; width: 1024px; height: 640px; background: url('http://chuangshicdn.data.mvbox.cn/album/21/09/17/21091709022912212887.jpg') no-repeat center/cover; box-shadow: 0px 0px 0px #000; position: relative; display: grid; place-items: center; user-select: none; z-index: 1; --opt: .10;}
#papa::before { position: absolute; content: ''; width: 1024px; height: 640px; background: url('http://chuangshicdn.data.mvbox.cn/album/22/06/22/22062210335112503592.gif')repeat center/cover; opacity: var(--opt); }
#mplayer { position: absolute; bottom: 20px; display: grid; grid-template-columns: auto auto; place-items: center; z-index: 9; }
#btnplay { position: absolute;
        width: 90px;
        height: 90px;
        left: -150px;
        bottom: 30px;border: 2px solid #000000;background: url('http://pan.yinhuabbs.cn/view.php/a60d7a6c4172d96080d4e23d80d9af48.png')0 0/100% 100%,conic-gradient(red,orange,yellow,green,teal,blue,#ff0000);
        mask: radial-gradient(transparent 7px,#red 0);
        -webkit-mask: radial-gradient(transparent 7px,red 0);
        border-radius: 50%; cursor: pointer; animation: rot linear 3s infinite; }
#lrc { --motion: cover1; --tt: 5s; --state: paused; position: absolute; bottom: 60px; font: bold 2.4em sans-serif; color: hsl(0,10%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0,100%,0%,.85)); }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(180deg,hsla(60,100%,50%,.75),hsla(120,100%,50%,.75)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(1turn); } }
</style>

<div id="papa">
      <div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
      <div id="mplayer">
                <span id="btnplay"></span>
                <svg id="iplay" width="600" height="20">
                        <line id="track"stroke-linecap="round" />
                        <line id="prog"stroke-linecap="round" />
                     <divid="audtime"style="position: absolute;left: -150px;color: hsl(0,10%,90%);">00:00 | 00:00</div>
                </svg>
      </div>
</div>

<script>
(function() {
      let len = track.getTotalLength(), aud = new Audio(), mKey = 0, mFlag = true;
      aud.src = 'https://www.qqmc.com/mp3/music206510706.mp3';
      let lrcAr = [
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
       
];
      aud.loop = true;
      aud.autoplay = true;
      btnplay.style.animationPlayState = aud.paused ? 'paused' : 'running';
      btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
      aud.addEventListener('seeked', () => calcKey());
      prog.onclick = track.onclick = (e) => aud.currentTime = aud.duration * (e.offsetX - 10) / len;
      aud.addEventListener('pause', () =>mState());
      aud.addEventListener('play', () =>mState());
      aud.addEventListener('timeupdate', () => {prog.style.strokeDashoffset = len - aud.currentTime * len / aud.duration;audtime.textContent = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);for(j=0; j<lrcAr.length; j++) {if(aud.currentTime >= lrcAr) {cKey = j;if(mKey === j) showLrc(lrcAr);else continue;}}});
      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 time = lrcAr - (aud.currentTime - lrcAr);showLrc(time);};
      let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrc.dataset.lrc = lrcAr;lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};
      let mState = () => aud.paused ? (btnplay.style.animationPlayState = 'paused',lrc.style.setProperty('--state', 'paused'),papa.style.setProperty('--opt','0')) : (btnplay.style.animationPlayState = 'running', lrc.style.setProperty('--state', 'running'),papa.style.setProperty('--opt','.15'));
      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-10-20 23:11

好家伙。会玩。

马黑黑 发表于 2022-10-20 23:47

好制作,赞

红影 发表于 2022-10-23 19:25

效果和光盘可联动。真漂亮的制作。欣赏亚伦老师好帖{:4_187:}
页: [1]
查看完整版本: 大哥的女人【马黑老师源码】