【三伏消暑】第二天 朵 《朵朵花儿开》- 高铭潞
本帖最后由 加林森 于 2022-7-17 09:00 编辑 <br /><br /><style>#papa { left: -202px; width: 1024px; height: 768px; background: #333 url('https://pic.imgdb.cn/item/62d2c450f54cd3f93736a805.jpg') no-repeat center/cover; box-shadow: 4px 4px 24px #7e6f52; position: relative; }
#papa input { border: none; outline: none; opacity: .75; cursor: pointer; }
#papa p { margin: 0; padding: 0; }
.playbox { position: absolute; left: 450px; bottom: 30px; padding: 10px; font: normal 1em sans-serif; color: #B8972B; 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; }
#circle { left: 100px; top: -20px; width: 350px; height: 150px; border-radius: 20%; position: absolute; }
.star { position: absolute; width: 3px; height: 3px; background: #b35c44; }
@keyframes flash { to { opacity: 0; } }
</style>
<div id="papa">
<div id="circle"></div>
<div class="playbox">
<p id="geci" style="font-size: 1.2em; text-shadow: 1px 1px 1px #222">朵朵花儿开 - 高铭潞 </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=1824979020.mp3" autoplay="autoplay" loop="loop"></audio>
<script>
let slip = 0, idx = 0, total = 500, gap = 100;
let add = setInterval(addDot, gap), del;
let num = (min, max) => Math.floor(Math.random() * (max-min+1)) + min;
let lrcAr = [
['0.00','朵朵花儿开 - 高铭潞'],
['0.71','所属专辑:龙乐合集 3'],
['280.00','谢谢欣赏!']
];
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('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 - slip){
geci.innerHTML = lrcAr;
}
}
});
let toMin = (val) => {
if(!val) return '0:0';
val = Math.floor(val);
return parseInt(val / 60) + ':' +parseFloat(val % 60);
}
function addDot() {
let ele = document.createElement('span');
let ww = circle.offsetWidth / 2;
ele.className = 'star';
ele.style.animation = 'flash ' + 0.1 * num(10,50) + 's infinite';
let pos = calcCirclePos({x: ww, y: ww, r: num(0,ww - 2), a: num(0,360)});
ele.style.left = pos.xx + 'px';
ele.style.top = pos.yy + 'px';
circle.appendChild(ele);
idx ++;
if(idx >= total){
clearInterval(add);
idx = 0;
del = setInterval(delDot, gap);
}
}
function delDot() {
let ele = document.querySelector('.star');
if(ele) {
circle.removeChild(ele);
} else {
clearInterval(del);
add = setInterval(addDot,gap);
}
}
function calcCirclePos({x,y,r,a}) {
let xx = x + r * Math.cos((a * Math.PI) / 180);
let yy = y + r * Math.sin((a * Math.PI) / 180);
return {xx,yy};
}
</script>
百花争艳,真美啊。图片是队长自己拍的吧,真好{:4_187:} 红影 发表于 2022-7-17 09:07
百花争艳,真美啊。图片是队长自己拍的吧,真好
是朋友拍的。 符合题意,很好听{:4_187:} 小九 发表于 2022-7-17 09:23
符合题意,很好听
是老歌曲了。小九上午好!{:4_204:} 好看,看好你,一朵顶两朵{:4_189:} 樵歌 发表于 2022-7-17 10:06
好看,看好你,一朵顶两朵
咱们换着花样玩。 本帖最后由 梦油 于 2022-7-17 11:28 编辑
花团锦簇,太漂亮啦!
俺没分了。
{:4_201:}
梦油 发表于 2022-7-17 11:27
花团锦簇,太漂亮啦!
俺没分了。
你喜欢就好。{:4_170:} 加林森 发表于 2022-7-17 09:09
是朋友拍的。
嗯嗯,很不错,非常美{:4_187:} 红影 发表于 2022-7-17 12:43
嗯嗯,很不错,非常美
是的。挺漂亮的。 加林森 发表于 2022-7-17 11:30
你喜欢就好。
太美了! 梦油 发表于 2022-7-17 13:39
太美了!
那就好。 加林森 发表于 2022-7-17 10:23
咱们换着花样玩。
怎么好玩怎么玩{:4_173:} 樵歌 发表于 2022-7-17 15:55
怎么好玩怎么玩
是的。 漂亮,有了立体的感觉{:4_199:}{:4_199:}{:4_199:} 转转 发表于 2022-7-17 17:47
漂亮,有了立体的感觉
谢谢转转支持!
页:
[1]