小辣椒 发表于 2022-11-9 22:06

梁静茹 - 慢冷(学习黑黑梦田效果)

<style>
#papa {
      margin: 100px 0 0 calc(50% - 781px);
      width: 1400px;
      height: 750px;
      background: gray url('https://pan.365.tf/uploads/lxx/20221109/63b.jpg') no-repeat center/cover;
      display: grid;
      place-items: center;
      box-shadow: 3px 3px 20px #000;
      user-select: none;
      overflow: hidden;
      perspective: 1000px;
      position: relative;
      z-index: 1;
}

#mplayer {
      position: absolute;
      bottom: 20px; left: 100px;
      grid-template-columns: auto auto auto;
      gap: 6px;
      display: grid;
      place-items: center;
      font: normal 16px sans-serif;
      color: snow;
      z-index: 999;
}

#btnplay {
      margin-right: -4px;
      width: 30px;
      height: 30px;

      font: bold 30px/30px serif;
      text-align: center;
      cursor: pointer;
      animation: rot 4s infinite linear;
      animation-play-state: var(--state);
      --state: paused;
}

#prog {
      width: 200px;
      height: 20px;
      cursor: pointer;
}

#lrc {
      --state: running;
      --motion: cover2;
      --tt: 1s;
      position: absolute;
      top: 120px;
      font: bold 2.4em sans-serif;
      color: hsl(240, 50%, 90%);
      -webkit-background-clip: text;
      filter: drop-shadow(1px 1px 2px hsla(30, 10%, 10%, .95));
      z-index: 1000;
}

#lrc::before {
      position: absolute;
      content: attr(data-lrc);
      width: 20%;
      height: 100%;
      color: transparent;
      overflow: hidden;
      white-space: nowrap;
      background: linear-gradient(180deg, hsla(240, 60%, 50%, .45), hsla(240, 100%, 60%, .75));
      filter: inherit;
      -webkit-background-clip: text;
      animation: var(--motion) var(--tt) linear forwards;
      animation-play-state: var(--state);
}
.star {
      --rr: 300px;
      position: absolute;
      width: 4px;
      height: 4px;
      border-radius: 50% 50% 25% 50%;
      transform-origin: 50% 50%;
      transform-style: preserve-3d;
}
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(1turn); } }
@keyframes fly { to { transform: rotate(0) translate(0); } }
</style>

<div id="papa">
      <div id="lrc" data-lrc="花潮论坛lrc在线">花潮论坛lrc在线</div>
      <div id="mplayer">
                <span id="btnplay">◑</span>
                <meter id="prog" low="30" high="90" max="100" optimum="100" value="1"></meter>
                <span id="tmsg">00:00 | 00:00</span>
      </div>
</div>
<audio id="aud" src="https://pan.365.tf/uploads/lxx/20221109/06.mp3" loop autoplay></audio>

<script>
(function() {
let mKey = 0, mSeek = false, mFlag = true;
       let lrcAr = [
                ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ,
        ];
      (function() {
                Array.from({length: 100}).forEach((item,key) => {
                        item = document.createElement('span');
                        item.className = 'star';
                        let ww = Math.ceil(Math.random() * 20) | 10;
                        item.style.cssText += `
                              width: ${ww}px;
                              height: ${ww}px;
                              left: ${Math.random()*10 + 300}px;
                              top: ${Math.random()*0 + 140}px;
                              background: hsla(${360*Math.random()},100%,50%,.75);
                              transform: rotate(${Math.random() * 720}deg) translate3d(${Math.random() * 500}px,${Math.random() * 300}px,${Math.random() * 1000}px);
                              animation: fly 80s infinite ${-10 - Math.random() * 20}s linear;
                        `;
                        papa.appendChild(item);
                });
      })();
      btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
      prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
      aud.addEventListener('pause', () => mState());
      aud.addEventListener('play', () => mState());
      aud.addEventListener('seeked', () => calcKey());
      aud.addEventListener('timeupdate', () => {
                prog.value = aud.currentTime / aud.duration * 100;
                tmsg.innerText = `${toMin(aud.currentTime)} | ${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.setProperty('--state', 'paused'), lrc.style.setProperty('--state', 'paused')) : (btnplay.style.setProperty('--state', 'running'), lrc.style.setProperty('--state', 'running'));
      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 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 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>

小辣椒 发表于 2022-11-9 22:08

@马黑黑

图图里面加个美女向上看的人物,就把那些大粒子移动到边角上了

小辣椒 发表于 2022-11-9 22:09

时间过真快。10点多了,我得下了

马黑黑 发表于 2022-11-9 22:10

设计好绝妙,棒棒哒!
这速度,也是光脚跑的{:4_170:}

小辣椒 发表于 2022-11-9 22:11

马黑黑 发表于 2022-11-9 22:10
设计好绝妙,棒棒哒!
这速度,也是光脚跑的

我也是匆匆忙忙的,歌词不是今天做的

马黑黑 发表于 2022-11-9 22:12

小辣椒 发表于 2022-11-9 22:11
我也是匆匆忙忙的,歌词不是今天做的
这个设计也是绝了,一切的一切,看似随手拈来,却是精心布置的

小辣椒 发表于 2022-11-9 22:12

先找了个图,加了人物斜视上面,我就移动了粒子尺寸了

小辣椒 发表于 2022-11-9 22:15

马黑黑 发表于 2022-11-9 22:12
这个设计也是绝了,一切的一切,看似随手拈来,却是精心布置的

这个图图网络搜索的{:4_189:}

美女是自己电脑里面找的

小辣椒 发表于 2022-11-9 22:16

美女PS里面加进去拉了斜度,脸还是不够向上

小辣椒 发表于 2022-11-9 22:17

下了。。。。。

马黑黑 发表于 2022-11-9 22:18

小辣椒 发表于 2022-11-9 22:15
这个图图网络搜索的

美女是自己电脑里面找的

表达元素的来源不重要,重要的是如果将这些元素有机结合起来且能渲染出主题,你做到了

红影 发表于 2022-11-9 22:55

这个漂亮,亲爱的厉害,这么快就做出了黑黑最新的效果{:4_199:}

相约爱晚亭 发表于 2022-11-10 07:50

灵活应用代码的典范,学习!

梦油 发表于 2022-11-10 10:54

小辣椒朋友早晨好!你遴选的歌曲真好听。谢谢分享。

樵歌 发表于 2022-11-10 12:38

一看就会,一学就上手。虽然喜欢,但右下角少五个字有点不适应。{:4_173:}

小辣椒 发表于 2022-11-10 21:32

马黑黑 发表于 2022-11-9 22:18
表达元素的来源不重要,重要的是如果将这些元素有机结合起来且能渲染出主题,你做到了

谢谢黑黑的鼓励{:4_187:}

小辣椒 发表于 2022-11-10 21:35

红影 发表于 2022-11-9 22:55
这个漂亮,亲爱的厉害,这么快就做出了黑黑最新的效果

亲爱的,这个也是套用,就移动了一下粒子的位子和移动一下播放器位置,只是我制作实践了一下{:4_170:}

小辣椒 发表于 2022-11-10 21:36

相约爱晚亭 发表于 2022-11-10 07:50
灵活应用代码的典范,学习!

问好爱晚亭,谢谢欣赏{:4_187:}

小辣椒 发表于 2022-11-10 21:41

梦油 发表于 2022-11-10 10:54
小辣椒朋友早晨好!你遴选的歌曲真好听。谢谢分享。

梦油晚上好,我也是感觉这首歌好听{:4_173:}

小辣椒 发表于 2022-11-10 21:42

樵歌 发表于 2022-11-10 12:38
一看就会,一学就上手。虽然喜欢,但右下角少五个字有点不适应。

樵哥哥晚上好,哪里有5个字?我怎么没有看见
页: [1] 2 3 4
查看完整版本: 梁静茹 - 慢冷(学习黑黑梦田效果)