【三伏消暑】第九天 帆:《我要你好好的》- 帆布小镇(Canvas Townlet)
<style>
#papa { left: -108px; width: 800px; height: 515px; margin-top: 120px; background: #eee url('https://pic.imgdb.cn/item/62dccee6f54cd3f937dedc63.gif') no-repeat; background-position: 1004px 0; box-shadow: 4px 4px 20px #000; overflow: hidden; position: relative; }
#prologue { position: absolute; width: 237px; height: 137px; left: calc(50% - 120px); top: calc(50% - 120px); cursor: pointer; transition: left 4s; }
#papa p { margin: 0; padding: 0; }
#papa input { border: none; outline: none; opacity: .75; cursor: pointer; }
#playbox { position: absolute; left: 1004px; bottom: 10px; padding: 10px; font: normal 1em sans-serif; color: #CCCCCC; background: rgba(255,255,255,.2); border-radius: 8px; backdrop-filter: blur(1px); overflow: hidden; box-shadow: 1px 1px 2px rgba(0,0,0,.15); z-index: 100; }
#btnplay { width: 30px; height: 30px; border-radius: 50%; }
#btnplay:hover { background: #aaa; color: #ff0000; }
</style>
<div id="papa">
<img id="prologue" src="https://pic.imgdb.cn/item/62dccbeaf54cd3f937cdaef2.gif" alt="" />
<div id="playbox">
<p id="geci" style="font-size: 1.2em; text-shadow: 1px 1px 1px #222">LRC Loading ... </p>
<p style="display: flex; align-items: center; gap: 4px; margin-top: 10px;">
<input id="btnplay" type="button" value=">" />
<input id="slider" type="range" min="0" max="100" value="0" />
<span id="per">0%</span>
</p>
</div>
</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=1438463386.mp3"></audio>
<script>
let ww = papa.offsetWidth;
let num = (min, max) => Math.floor(Math.random() * (max-min+1)) + min;
let lrcAr = [
['0.00','我要你好好的 '],
['60.00','歌手:帆布小镇(Canvas Townlet)'],
['180.00','谢谢欣赏']
];
prologue.onclick = () => {
prologue.style.transform = 'scale(1,1)';
prologue.style.left = '-240px';
aud.play();
iniBg(papa,0,0);
iniBg(playbox,1,10);
}
slider.onmousedown = () => aud.pause();
slider.onchange = () => { aud.currentTime = slider.value * aud.duration / 100; aud.play(); }
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('playing', () => btnplay.value = '||');
aud.addEventListener('pause', () => btnplay.value = '>');
aud.addEventListener('ended', () => {
iniBg(papa,0,ww);
iniBg(playbox,1,ww);
prologue.style.transform = 'scale(1,1)';
prologue.style.left = 'calc(50% - 120px)';
prologue.style.top = 'calc(50% - 120px)';
});
aud.addEventListener('timeupdate', () => {
let prog = 100 * aud.currentTime / aud.duration;
slider.value = prog;
per.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
for(j=0; j<lrcAr.length; j++){
if(aud.currentTime >= lrcAr) geci.innerHTML = lrcAr;
}
});
let toMin = (val) => {
if(!val) return '0:0';
val = Math.floor(val);
return parseInt(val / 60) + ':' +parseFloat(val % 60);
}
let iniBg = (ele,id,number) => {
ele.style.transition = 'all 4s';
id == 0 ? ele.style.backgroundPosition = number + 'px' : ele.style.left = number + 'px';
}
</script>
还在想帆字在哪呢,原来在歌手的名字里{:4_173:}
这个透明的跑步真好看。欣赏队长好帖{:4_187:} 队长这个动图加进去增加了这个背景图图的灵动感{:4_178:} 红影 发表于 2022-7-24 13:15
还在想帆字在哪呢,原来在歌手的名字里
这个透明的跑步真好看。欣赏队长好帖
哈哈,就是歌手的名字。谢谢红影支持! 小辣椒 发表于 2022-7-24 13:55
队长这个动图加进去增加了这个背景图图的灵动感
我又学习了老黑的今天制作的“江河水”,也制作了一个出来。挺好玩的。{:4_189:} 天行健,君子自强不息,跑步者{:4_178:}鼓舞人们踔厉风发,大赞 以后可以一律以娴熟的马术来解决。{:4_189:} 浣溪沙 发表于 2022-7-24 15:15
天行健,君子自强不息,跑步者鼓舞人们踔厉风发,大赞
谢谢沙沙点评! 樵歌 发表于 2022-7-24 16:21
以后可以一律以娴熟的马术来解决。
就是,这样以免太麻烦了。{:4_189:} 队长厉害,又重做一个了啊 醉美水芙蓉 发表于 2022-7-24 16:42
队长做得漂亮!透明图片灵动!
是的。好玩好玩。 绿叶清舟 发表于 2022-7-24 16:45
队长厉害,又重做一个了啊
是的。反正没有事情就做着玩吧。{:4_189:} 加林森 发表于 2022-7-24 16:48
是的。反正没有事情就做着玩吧。
也是你厉害啊,一做一个这么快的 绿叶清舟 发表于 2022-7-24 19:14
也是你厉害啊,一做一个这么快的
我把明天的也制作出来了。{:4_170:} 加林森 发表于 2022-7-24 19:20
我把明天的也制作出来了。
厉害啊永远走在时间前面的了 绿叶清舟 发表于 2022-7-24 19:22
厉害啊永远走在时间前面的了
明天早晨来发。{:4_189:} 加林森 发表于 2022-7-24 14:19
哈哈,就是歌手的名字。谢谢红影支持!
这个动图加得特别好{:4_187:} 红影 发表于 2022-7-24 20:43
这个动图加得特别好
嗯嗯,我一看见就立即喜欢上了。 加林森 发表于 2022-7-24 20:49
嗯嗯,我一看见就立即喜欢上了。
能找到这个也不容易呢{:4_204:}
页:
[1]
2