梦油 发表于 2022-6-8 10:59

加林森 发表于 2022-6-7 21:08
我是有样就学习。

你具有很好的悟性

加林森 发表于 2022-6-8 11:20

本帖最后由 加林森 于 2022-7-15 23:11 编辑 <br /><br />梦油 发表于 2022-6-8 10:59
你具有很好的悟性
嗯嗯,好像有点的。{:4_189:}

<style>
#papa { left: -202px; width: 1024px; height: 768px; background: #333 url('https://pic.imgdb.cn/item/62d17635f54cd3f937a4a9a4.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: 120px; 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=165352.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','阿诗玛-瓦其依合'],
        ['2.71','所属专辑:黑鹰之梦'],
        ['3.60','作词 : 瓦其依合'],
        ['5.35','作曲 : 瓦其依合'],
        ['6.58','发行 : 北京玖玖玖加时代文化传媒有限公司'],
        ['14.60','我闭上眼睛伊呀罗喂'],
        ['16.42','想起你呀伊呀罗喂'],
        ['20.24','我闭上眼睛伊呀罗喂'],
        ['22.80','想起你呀伊呀罗喂'],
        ['39.66','放不下的是你'],
        ['80.77','哦盛满爱与恨的小背篓'],
        ['91.53','猜不透的是你'],
        ['101.28','哦神秘莫测的微微笑'],
        ['111.29','很多人来了(咿呀嗬哦)'],
        ['120.56','你还在不变的沉默(咿耶)'],
        ['130.01','很多年去了(咿呀哦嗬哦)'],
        ['139.66','我还在不停的守候'],
        ['188.19','我又将离去(耶咿耶)'],
        ['197.01','在你不曾预见的世间游走'],
        ['207.07','我不会迷失(啊咿耶)'],
        ['215.87','会寻着你目光的方向回归'],
        ['226.35','如果还可以(啊咿呀嗬哦)'],
        ['235.04','让森林变成绿的家(咿耶)'],
        ['244.57','如果还可以(啊咿呀嗬哦)'],
        ['254.85','让你用当年的声音 为我呼喊'],
        ['269.41','我还在不停的守候'],
        ['272.09','我闭上眼睛伊呀罗喂'],
        ['274.42','想起你呀伊呀罗喂'],
        ['279.01','我闭上眼睛伊呀罗喂'],
        ['283.88','想起你呀伊呀罗喂'],
        ['288.68','我闭上眼睛伊呀罗喂'],
        ['293.59','我想起你呀伊呀罗喂'],
        ['298.22','我闭上眼睛伊呀罗喂'],
        ['303.18','我想起你呀伊呀罗喂'],
        ['304.60','我想起你呀伊呀罗喂'],
        ['312.61','我想起你呀伊呀罗喂']
];

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>


梦油 发表于 2022-6-8 11:37

加林森 发表于 2022-6-8 11:20
嗯嗯,好像有点的。

没错,你有很好的悟性,所以学什么东西都快。

加林森 发表于 2022-6-8 11:45

梦油 发表于 2022-6-8 11:37
没错,你有很好的悟性,所以学什么东西都快。

这个主要是很喜欢音乐的结果。

梦油 发表于 2022-6-8 13:04

加林森 发表于 2022-6-8 11:45
这个主要是很喜欢音乐的结果。

是的,很有关系。

加林森 发表于 2022-6-8 13:22

梦油 发表于 2022-6-8 13:04
是的,很有关系。

嗯嗯
页: 1 [2]
查看完整版本: 《春分》- 音阙诗听王梓钰 (根据老黑歌词显示板毛玻璃效果制作)