聆听秋声
<style>
#papa { left: -400px; width: 1400px; height: 800px; background: tan url('https://pic1.imgdb.cn/item/6354cf6016f2c2beb1e5fe2b.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
#mplayer { position: absolute; bottom: 0; width: 300px; height: 80px; user-select: none; display: grid; place-items: center; cursor: pointer; }
#mplayer:hover #btnwrap, #mplayer:hover #prog { transform: translateY(var(--yy)); }
#mplayer:hover #btnwrap { background: linear-gradient(to top right, rgba(0,0,105,.45), rgba(200,0,0,.35)); border-radius: 50%; opacity: .75; }
#btnwrap, #prog { position: absolute; display: grid; place-items: center; transition: .5s; }
#btnwrap { --yy: -15px; width: 40px; height: 40px; transform: rotate(45deg); border: 1px solid white; border-radius: 6px; opacity: .25; }
#btnplay { width: 20px; height: 20px; background: rgba(255,255,255,.45); clip-path: polygon(0 0, 0 100%, 100% 50%); }
#btnpause { width: 2px; height: 20px; border-style: solid; border-width: 0px 4px; border-color: transparent rgba(255,255,255,.45); display: none; }
#prog { --yy: 20px; width: 300px; height: 16px; border-radius: 10px; background: linear-gradient(90deg, rgba(0,0,255,.45), rgba(255,0,0,.35) 100%, transparent 0); border: 1px solid gray; font: normal 14px / 16px sans-serif; color: snow; }
#lrc { position: absolute; top: 20px; text-shadow: 1px 1px 1px #000; }
.lrcChar { margin: 2px; padding: 8px; width: 40px; height: 40px; text-align: center; border-radius: 20% 40%; font: bold 2em / 40px sans-serif; display: inline-block; text-shadow: 1px 1px 1px #000; opacity: .8; backdrop-filter: blur(20px); position: relative; }
#tree { position: absolute; bottom: 60px; right: 10px; }
.leaf { position: absolute; left: 60px; top: 0; width: 100px; transform: rotate(-160deg); offset-distance: 0; offset-path: path("M20 0 Q0 200, 100 200 Q340 220, 170 660"); animation: move 8s linear infinite; }
@keyframes move { to { offset-distance: 100%;} }
</style>
<div id="papa">
<img class="leaf" src="./pic/leaf.png" alt="" />
<div id="mplayer">
<div id="btnwrap"><span id="btnplay"></span><span id="btnpause"></span></div>
<div id="prog">00:00 | 00:00</div>
</div>
<div id="lrc"></div>
</div>
<script>
let aud = new Audio();
let setColor = () => Math.random().toString(16).substr(-6);
let ranNum = (min,max) => Math.floor(Math.random() * (max - min + 1)) + min;
aud.src = 'https://music.163.com/song/media/outer/url?id=1921683713.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.background= 'linear-gradient(65deg, rgba(0,0,255,.45), rgba(255,0,0,.35) ' + aud.currentTime / aud.duration * 100 + '%, transparent 0)';
prog.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
});
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;
}
let mkLrc = (text) => {
let tstr = '';
Array.from({length: text.length}).forEach((ele,key) => {
tstr += `<span class="lrcChar" style='top: ${ranNum(-10, 10)}px; background: #${setColor()}; color: #${setColor()};'>${text.substr(key,1)}</span>`;
});
return tstr;
}
lrc.innerHTML = mkLrc('聆听秋声');
</script> 老头好制作,红枫叶,马上深秋了 播放器也是用上了,老头活学活用{:4_170:}
歌词麻烦直接免了{:4_189:} 这个标题字也是很喜欢,老头每个作品都是棒棒的,{:4_199:} 小辣椒 发表于 2022-10-23 18:13
播放器也是用上了,老头活学活用
歌词麻烦直接免了
老头简单,麻烦的都不要。。。。。{:5_117:} 小辣椒 发表于 2022-10-23 18:14
这个标题字也是很喜欢,老头每个作品都是棒棒的,
谢谢师傅夸奖。。。。{:4_204:} 小辣椒 发表于 2022-10-23 18:12
老头好制作,红枫叶,马上深秋了
秋深了。人老了。。。。。。。。{:5_103:} 秋声,深邃而不可致知,如三月不知肉味之乐也。 东篱闲人 发表于 2022-10-23 18:24
老头简单,麻烦的都不要。。。。。
简单也是一种美{:4_187:} 东篱闲人 发表于 2022-10-23 18:25
秋深了。人老了。。。。。。。。
老头多保重,天凉了,衣服多穿一点,老棉袄不热,你应该换新的羽绒服了 东篱闲人 发表于 2022-10-23 18:24
谢谢师傅夸奖。。。。
是真的漂亮,我很喜欢但我不会做 马黑黑 发表于 2022-10-23 19:09
秋声,深邃而不可致知,如三月不知肉味之乐也。
嗯嗯,秋之境,让人的思绪很长很长。。。。{:4_190:} 小辣椒 发表于 2022-10-23 19:31
简单也是一种美
就爱听师傅唠嗑。。。{:5_117:} 小辣椒 发表于 2022-10-23 19:33
老头多保重,天凉了,衣服多穿一点,老棉袄不热,你应该换新的羽绒服了
老棉袄实在。。。。{:5_117:} 东篱闲人 发表于 2022-10-23 19:47
嗯嗯,秋之境,让人的思绪很长很长。。。。
所以望穿秋水,听尽秋声 醉美水芙蓉 发表于 2022-10-23 19:42
东篱老师应该换新衣服了!天冷了,该换羽绒服了!老师的图图意境都很美!
这老棉袄还暖,主要俺念旧。。。。{:5_117:} 马黑黑 发表于 2022-10-23 19:48
所以望穿秋水,听尽秋声
是啊是啊,人生苦短。。。。 东篱闲人 发表于 2022-10-23 19:49
是啊是啊,人生苦短。。。。
可以续,可以续 马黑黑 发表于 2022-10-23 19:52
可以续,可以续
嗯嗯,向苍天再借500年!{:5_112:}
页:
[1]
2