绿叶清舟 发表于 2022-10-22 22:21

抓不到

本帖最后由 绿叶清舟 于 2022-10-24 10:40 编辑 <br /><br /><style>
#papa { margin: auto; left: -250px; width: 1100px; height: 700px; background: url('https://pic1.imgdb.cn/item/6355fb8816f2c2beb13c7d28.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; display: grid; place-items: center; user-select: none; z-index: 1; --opt: .25;}
#mplayer { position: absolute; bottom: 20px; display: grid; grid-template-columns: auto auto auto; place-items: center; gap: 6px; user-select: none; }
#btnplay { width: 40px; height: 40px; text-align: center; font: normal 40px/40px sans-serif; color: snow; cursor: pointer; animation: rot linear 4s infinite; }
#prog { --ww: 0px; width: 300px; height: 12px; border: 1px solid green; border-radius: 6px; background: snow; opacity: .65; position: relative; }
#prog::before { position: absolute; content: ''; width: var(--ww); height: 12px; border-radius: 6px; background: snow linear-gradient(90deg, orange, green); opacity: .75; }
#audtime { font: normal 14px sans-serif; color: snow; }
#lrc { --motion: cover1; --tt: 5s; --state: paused; position: absolute; top: 30px; font: bold 2.4em sans-serif; color: hsl(0,10%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0,0%,0%,.95)); }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(180deg,hsla(0,50%,20%,.45),hsla(140,100%,50%,.75)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
#fish { position: absolute; left: 150px;top: 250px;offset-path: path('M310 195a93.5 62 0 1 0 187 0a93.5 62 0 1 0 -187 0z'); offset-distance: 100%; animation: swim 50s infinite; }
#fish1 { position: absolute; left: 350px;top: 350px; mix-blend-mode: darken; }
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(1turn); } }
@keyframes swim { to { offset-distance: 0%; } }
</style>

<div id="papa">
<img id="fish1" src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20190130%2F5475872e0f8f49cf984975526d7b1040.gif&refer=http%3A%2F%2F5b0988e595225.cdn.sohucs.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669039338&t=638336bbefa242c3e46ed26a445a7121" alt="" />
      <img id="fish" src="https://wj1.zp68.com:812/lxx/yunhua/2022/10/02/gnyu.jpg" alt="" />
      <div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
      <div id="mplayer">
                <span id="btnplay">❁</span>
                <span id="prog"></span>
                <span id="audtime">00:00 | 00:00</span>
      </div>
</div>
<script>
(function() {
      let aud = new Audio(), mKey = 0, mFlag = true;
      
      aud.src = 'http://music.163.com/song/media/outer/url?id=1929449162.mp3';
      aud.loop = true;
      aud.autoplay = true;
      if(aud.paused) btnplay.style.animationPlayState = 'paused';
      btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
      prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
      aud.addEventListener('seeked', () => calcKey());
      aud.addEventListener('pause', () =>mState());
      aud.addEventListener('play', () =>mState());
      aud.addEventListener('timeupdate', () => {let prg = aud.currentTime * prog.offsetWidth / aud.duration < 6 ? 6 : aud.currentTime * prog.offsetWidth / aud.duration;prog.style.setProperty('--ww', prg + 'px');audtime.innerText = 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','.25'));
      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>{:4_189:}

马黑黑 发表于 2022-10-22 22:43

那么多猎物,就是抓不到,一个字,运气真差

友昕 发表于 2022-10-23 00:22

清舟的动画也做得这么好,赞{:5_116:}

梦油 发表于 2022-10-23 09:00

这只笨猫!{:4_170:}

红影 发表于 2022-10-23 23:01

这个好玩,居然配了这么首歌,听得笑{:4_173:}

绿叶清舟 发表于 2022-10-25 19:59

马黑黑 发表于 2022-10-22 22:43
那么多猎物,就是抓不到,一个字,运气真差

也许只是想玩玩呢

绿叶清舟 发表于 2022-10-25 19:59

友昕 发表于 2022-10-23 00:22
清舟的动画也做得这么好,赞

那是代码实现的

绿叶清舟 发表于 2022-10-25 20:00

梦油 发表于 2022-10-23 09:00
这只笨猫!

所以改吃猫粮了{:4_173:}

绿叶清舟 发表于 2022-10-25 20:00

红影 发表于 2022-10-23 23:01
这个好玩,居然配了这么首歌,听得笑

搜抓不到,就听到这首了{:4_189:}

红影 发表于 2022-10-25 20:04

绿叶清舟 发表于 2022-10-25 20:00
搜抓不到,就听到这首了

有意思,否则也不会遇到这首歌了。这帖子的标题文字好奇特的色彩,又是眼馋我的{:4_173:}

马黑黑 发表于 2022-10-25 20:27

绿叶清舟 发表于 2022-10-25 19:59
也许只是想玩玩呢

玩玩挺好

绿叶清舟 发表于 2022-10-25 20:27

马黑黑 发表于 2022-10-25 20:27
玩玩挺好

玩玩更健康{:4_189:}

绿叶清舟 发表于 2022-10-25 20:28

红影 发表于 2022-10-25 20:04
有意思,否则也不会遇到这首歌了。这帖子的标题文字好奇特的色彩,又是眼馋我的

就是啊,说好一天馋你一回的{:4_189:}

马黑黑 发表于 2022-10-25 20:28

绿叶清舟 发表于 2022-10-25 20:27
玩玩更健康

玩玩更长寿

梦油 发表于 2022-10-25 20:51

绿叶清舟 发表于 2022-10-25 20:00
所以改吃猫粮了

牠们养尊处优,连老鼠都敢欺负猫。

红影 发表于 2022-10-26 16:36

绿叶清舟 发表于 2022-10-25 20:28
就是啊,说好一天馋你一回的

哼那个哼,坏人呀坏人{:4_361:}

绿叶清舟 发表于 2022-10-26 20:06

红影 发表于 2022-10-26 16:36
哼那个哼,坏人呀坏人

{:4_189:}俺是大好人

绿叶清舟 发表于 2022-10-26 20:07

梦油 发表于 2022-10-25 20:51
牠们养尊处优,连老鼠都敢欺负猫。

是啊动物们先平等了{:4_173:}

梦油 发表于 2022-10-26 20:19

绿叶清舟 发表于 2022-10-26 20:07
是啊动物们先平等了

现在的猫全不捉老鼠了

绿叶清舟 发表于 2022-10-26 21:06

梦油 发表于 2022-10-26 20:19
现在的猫全不捉老鼠了

是啊,还能交朋友的了
页: [1] 2
查看完整版本: 抓不到