三月的阳光 发表于 2023-9-10 22:11

秋天不回来

<style>
#papa { left: -200px; width: 1280px; height: 697px; top: 120px; background: #333 url('https://tukuimg.bdstatic.com/scrop/c429277d5ea65bc5d85ee97d06a24325.gif') 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: 10px; width: 350px; height: 150px; border-radius: 20%; position: absolute; }
.star { position: absolute; width: 3px; height: 3px; background: #7e6f52; }
@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">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="http://music.163.com/song/media/outer/url?id=163123.mp3 " autoplay="autoplay" loop="loop"></audio>

<script>

let slip = 0, idx = 0, total = 700, gap = 200;
let add = setInterval(addDot, gap), del;
let num = (min, max) => Math.floor(Math.random() * (max-min+1)) + min;
let lrcAr = [
        ['0.00', ' 秋天不回来 - 王强',6.65],
['7.00', ' 编辑 :三月的阳光',7.04],
['14.41', '初秋的天冰冷的夜',2.84],
['17.40', '回忆慢慢袭来',3.05],
['20.61', '真心的爱就像落叶',2.87],
['23.63', '为何却要分开',2.42],
['26.18', '灰色的天独自彷徨',2.88],
['29.21', '城市的老地方',2.90],
['32.26', '真的孤单走过忧伤',2.75],
['35.16', '心碎还要逞强',2.76],
['38.06', '想为你披件外衣',2.82],
['41.03', '天凉要爱惜自己',4.22],
['45.47', '没有人比我更疼你',4.69],
['50.41', '告诉你在每个',2.93],
['53.49', '想你的夜里',3.33],
['57.00', '我哭的好无力',5.18],
['62.45', '就让秋风带走我的思念',3.21],
['65.83', '带走我的泪',2.84],
['68.82', '我还一直静静守候在',3.20],
['72.19', '相约的地点',2.60],
['74.93', '求求老天淋湿我的双眼',3.13],
['78.22', '冰冻我的心',2.40],
['80.75', '让我不再苦苦奢求你',3.32],
['84.25', '还回来我身边',4.19],
['88.66', '我身边',3.43],
['92.27', '灰色的天独自彷徨',27.74],
['121.47', '灰色的天独自彷徨',2.87],
['124.49', '城市的老地方',2.95],
['127.60', '真的孤单走过忧伤',2.94],
['130.69', '心碎还要逞强',2.65],
['133.48', '想为你披件外衣',2.93],
['136.56', '天凉要爱惜自己',4.02],
['140.79', '没有人比我更疼你',3.88],
['144.87', '告诉你在每个',3.74],
['148.81', '想你的夜里',4.10],
['153.13', '我哭的好无力',4.58],
['157.95', '就让秋风带走我的思念',4.20],
['162.37', '带走我的泪',2.79],
['165.31', '我还一直静静守候在',3.10],
['168.57', '相约的地点',2.58],
['171.29', '求求老天淋湿我的双眼',3.48],
['174.95', '冰冻我的心',2.57],
['177.66', '让我不再苦苦奢求你',2.84],
['180.65', '还回来我身边',3.94],
['184.80', '就让秋风带走我的思念',3.76],
['188.76', '带走我的泪',2.66],
['191.56', '我还一直静静守候在',3.28],
['195.01', '相约的地点',2.68],
['197.83', '求求老天淋湿我的双眼',3.28],
['201.28', '冰冻我的心',2.68],
['204.10', '让我不再苦苦奢求你',2.82],
['207.07', '还回来我身边',4.02],
['211.30', '我身边',2.61],
['214.05', '就让秋风带走我的思念',4.12],
['218.39', '带走我的泪',2.54],
['221.06', '我还一直静静守候在',3.96],
['225.23', '相约的地点',7.50],
['233.12', '',4.5]
,
];

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>
<br><br><br><br><br><br>

向荣春 发表于 2023-9-10 22:19

欣赏经典,漂亮的制作。阳光晚上好,{:9028:}辛苦了,祝你周末快乐!天天好心情!

三月的阳光 发表于 2023-9-10 22:22

向荣春 发表于 2023-9-10 22:19
欣赏经典,漂亮的制作。阳光晚上好,辛苦了,祝你周末快乐!天天好心情! ...

谢谢向荣老师欣赏,周末快乐~~{:10_402:}

楚心兰 发表于 2023-9-11 07:09

秋天来了!阳光正好,微风不燥!

楚心兰 发表于 2023-9-11 07:09

秋天来了!阳光正好,微风不燥!

蜻蜓 发表于 2023-9-11 16:46

师弟来了啊{:10_402:}

鲸落深蓝 发表于 2023-9-11 20:59

{:9022:}这首歌非常应景,秋天来了,帖子精美,歌曲精彩!!!

三月的阳光 发表于 2023-9-12 16:23

楚心兰 发表于 2023-9-11 07:09
秋天来了!阳光正好,微风不燥!

兰兰,下午好~~{:10_402:}

三月的阳光 发表于 2023-9-12 16:25

蜻蜓 发表于 2023-9-11 16:46
师弟来了啊

师妹,咋一下从师兄变成师弟了~~{:9005:}

三月的阳光 发表于 2023-9-12 16:26

鲸落深蓝 发表于 2023-9-11 20:59
这首歌非常应景,秋天来了,帖子精美,歌曲精彩!!!
谢谢蓝蓝欣赏~~{:10_402:}
页: [1] 2
查看完整版本: 秋天不回来