亚伦影音工作室 发表于 2023-12-22 11:51

你来与不来我都在等你

本帖最后由 亚伦影音工作室 于 2024-4-17 14:33 编辑 <br /><br /><style>
#papa {
        margin: 10px -300px;
        width: 1164px;
        height: 640px;
background:url('https://pic.imgdb.cn/item/65828ad4c458853aef54b999.png')no-repeat center/cover;
        box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 8px #880000;
        position: relative;overflow: hidden;
        z-index: 12345;
}
#mb{ position: absolute; width: 100%; height: 100%; top:0%;   z-index: 5; background:linear-gradient(0deg, #000000 4%,rgba(2, 2, 2, 0) 10%,rgba(2, 2, 2, 0) 0%,rgba(2, 2, 2, 0) 100%,#111111 90%);opacity: 1;}
#papa:hover #fullscreen { display:block ;opacity: 1;}
#fullscreen { position: absolute; top:5%; left:calc(85% - 15px);font: normal 2em/0em 楷体;color:#ffffff; opacity: 0; cursor: pointer; z-index: 111}
#bfq{bottom: -12px; left:0%;z-index: 6;
position: absolute;
width:100%;
cursor: pointer;
mix-blend-mode: lighten;filter:invert(100%)
}

#canv {display: block; position: absolute;width:100%; height: 200px; bottom: 20px; left: 0px;z-index:4; animation: sp 1s linear infinite;}
@keyframes sp {
      0% { filter:hue-rotate(360deg)contrast(150%)brightness(100%); }
}
#mpica { position: absolute;
        top: 0px;
        left: 0px;
        width: 100%;z-index: 1;
        height: 100%;background: url('https://www.kumeiwp.com/sub/filestores/2022/11/09/9d71b312b9587c941a35e338e496ae53.png')0 0/50% 50%;
        animation: flyy 100s linear infinite;
        cursor: pointer;
        opacity: 0.6;
}
#mpicca { position: absolute;
        top: 0px;
        left: 0px;background: url('https://www.kumeiwp.com/sub/filestores/2022/11/09/9d71b312b9587c941a35e338e496ae53.png')0 0/40% 40%;
        width: 100%;z-index: 1;
        height: 100%;
        animation: toto 80s linear infinite;
        cursor: pointer;
        opacity: 0.6;
}

@keyframes flyy {0%{
      background-position: 600% 0;
    }
    100%{
      background-position: 30% 1600%;filter:hue-rotate(360deg)
    }
}
@keyframes toto { 0%{
      background-position: 0% -1600%;
    }
    100%{
      background-position: 0% 0%;filter:hue-rotate(360deg)
    }
}

</style>
<div id="papa">
<div   id="mpica" ></div>
<div id="mpicca"></div>



<span id="fullscreen">全屏欣赏</span>
<div id="mb"></div>

<div id="bfq"><audio autoplay="" id="aud" loop="" controls="controls" style="width:100%;"src="https://www.kumeiwp.com/sub/filestores/2023/12/30/d25ae70831cf7ded8333332552b032d1.mp3" crossOrigin="anonymous">&nbsp;</audio></div>
<div data-lrc="亚伦影音工作室" id="lrc">亚伦影音工作室</div>

<canvas id='canv' width="1200" height="250"></canvas>


</div>

<style type="text/css">
#lrc {
        --state: paused;
        --motion: cover2;
        --tt: 2s;
        --bg: linear-gradient(180deg, #880000, #880000);
        position: absolute;z-index: 5;
        left: 50%;
        transform: translate(-50%);
        top: 85%;
        font:normal 3em 华文隶书;
        color: #000078;
        white-space: pre;
        -webkit-background-clip: text;
        filter:drop-shadow(#FFFFFF 1px 0 0)drop-shadow(#FFFFFF 0 1px 0)drop-shadow(#FFFFFF -1px 0 0) drop-shadow(#FFFFFF 0 -1px0);
}
#lrc::before {
        position: absolute;
        content: attr(data-lrc);
        width: 20%;
        height: 100%;
        color: transparent;
        overflow: hidden;
        white-space: pre;
        background: var(--bg);
       
        -webkit-background-clip: text;
        animation: var(--motion) var(--tt) linear forwards;
        animation-play-state: var(--state);
}
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
</style>
<script>
(function() {
/*原始lrc歌词*/
let lrcStr = `你来与不来我都在等你
静静 - 来与不来我都在等你
作词:绿柳
作曲:李旭辉
编曲:喜波
吉他:喜波
和声:南妮
录混:小多
制作人:绿柳
出版:绿柳传媒
沏一壶春色
我在等你
等你一起看小草
长出新绿
还记得那年
杏花烟雨
人海之中
你我相遇
掬一捧秋风
我在等你
等你一起看枫叶
染红天地
还记得
那年绵绵秋雨
花纸伞下
人影相依
你来与不来
我都在等你
等你和我去看
落花满地
想爱就爱
彼此珍惜
月亮它会见证
这奇迹
你来与不来
我都在等你
等你和我去听
落叶絮语
想爱就爱
不再分离
相拥着你
到下一个世纪
掬一捧秋风
我在等你
等你一起看枫叶
染红天地
还记得
那年绵绵秋雨
花纸伞下
人影相依
你来与不来
我都在等你
等你和我去看
落花满地
想爱就爱
彼此珍惜
月亮它会见证
这奇迹
你来与不来
我都在等你
等你和我去听
落叶絮语
想爱就爱
不再分离
相拥着你
到下一个世纪
你来与不来
我都在等你
等你和我去听
落叶絮语
想爱就爱
不再分离
相拥着你
到下一个世纪
天下有情人+
如果不是相信你 (烟嗓版)(DJ默涵版)+
此生有过你+
我不信你不惭愧 (DJ小桐版)+一世守候 – 茉莉乌龙茶
`;

/*变量 :mKey - 当前歌词索引;mFlag :调用关键帧动画索引;averAdd :平均值补偿*/
let mKey = 0, mFlag = true, averAdd = 0.3;

/*函数 :获取每句歌词用时,歌词用时若超过平均值则取平均值,最后一句歌词则取平均值*/
let lrcTime = (ar) => {
        let tmpAr = [];
        for(j = 0; j <ar.length - 1; j ++) {
                if(j !== ar.length - 1) tmpAr = parseFloat((ar - ar).toFixed(1));
        }
        let aver = parseInt(tmpAr.reduce((a,b) => a + b) / (tmpAr.length - 1)) + averAdd;
        tmpAr.push(aver);
        tmpAr.forEach((item,key) => {
                ar = item > aver ? aver : item;
        });
        return ar;
};

/*函数 :从原始lrc歌词获取信息并存入 n*3 数组*/
let getLrcAr = (text) => {
        let lrcAr = [];
        let calcRule = ;
        for(x of text.split('\n')) {
                let ar = [];
                let re = /\d+[\.:]\d+([\.:]\d+)?/g;
                let geci = x.replace(re,'');
                if(geci) {
                        geci = geci.replace(/[\[\]\'\"\t,]s?/g,'');
                        let time = x.match(re);
                        if(time != null) {
                                for(y of time) {
                                        let tmp = y.match(/\d+/g);
                                        let sec = 0;
                                        for(z in tmp) sec += tmp * calcRule;
                                        ar = ;
                                        lrcAr.push(ar);
                                }
                        }
                }
        }
        lrcAr.sort((a,b)=> a - b);
        return(lrcTime(lrcAr));
};

/*函数 :模拟显示同步歌词*/
let showLrc = (time) => {
        let name = mFlag ? 'cover1' : 'cover2';
        lrc.innerHTML = lrcAr;
        lrc.dataset.lrc = lrcAr;
        lrc.style.setProperty('--motion', name);
        lrc.style.setProperty('--tt', time + 's');
        lrc.style.setProperty('--state', 'running');
        mKey += 1;
        mFlag = !mFlag;
};

/*函数 :处理当前歌词索引 mKey*/
let calcKey = () => {
        for (j = 0; j < lrcAr.length; j++) {
                if (aud.currentTime <= lrcAr) {
                        mKey = j - 1;
                        break;
                }
        }
        if (mKey < 0) mKey = 0;
        if (mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;
        let time = lrcAr - (aud.currentTime - lrcAr);
        showLrc(time);
};

/*格式化时间信息*/
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 mState = () => aud.paused ? (lrc.style.setProperty('--state','paused')) : (lrc.style.setProperty('--state','running'));

/*监听播放进度*/
aud.addEventListener('timeupdate', () => {
        for (j = 0; j < lrcAr.length; j++) {
                if (aud.currentTime >= lrcAr) {
                        cKey = j;
                        if (mKey === j) showLrc(lrcAr);
                        else continue;
                }
        }
});
aud.addEventListener('pause', () => mState());/*监听暂停事件*/
aud.addEventListener('play', () => mState());/*监听播放事件*/
aud.addEventListener('seeked', () => calcKey());/*监听查询事件*/
let lrcAr = getLrcAr(lrcStr); /*获得歌词数组*/
})();


let fs = true;
      fullscreen.onclick = () => {
                fs ? (fullscreen.innerText = '退出全屏', papa.requestFullscreen()) : (fullscreen.innerText = '全屏欣赏', document.exitFullscreen());
                fs = !fs;
      };
mpica.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>mpica.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>mpica.style.animationPlayState = 'paused');


mpicca.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>mpicca.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>mpicca.style.animationPlayState = 'paused');

</script>

<script>
(function () {

        let Act = new AudioContext();

        let audSrc = Act.createMediaElementSource(aud);

        let analyser = Act.createAnalyser();

        audSrc.connect(analyser);

        analyser.connect(Act.destination);

        let ctx = canv.getContext('2d');

        let width = canv.width;

        let height = canv.height;

        let ppColor = ctx.createLinearGradient(350,200,350,0);

        ppColor.addColorStop(0.6, '#00ff00');

        ppColor.addColorStop(0.4, '#00ff00');

        ppColor.addColorStop(0, '#00ff00');

        let ppNum = 200;

        let voiceHeight = new Uint8Array(analyser.frequencyBinCount);



        (function draw() {

                analyser.getByteFrequencyData(voiceHeight);

                let step = Math.round(voiceHeight.length / ppNum);

                ctx.clearRect(0, 0, width, height);

                for (let j = 0; j < ppNum; j++) {

                        let audiheighteight = voiceHeight;

                        ctx.fillStyle = ppColor;

                        ctx.fillRect(width / 2 + (j * 10), height, 6, -audiheighteight);

                        ctx.fillRect(width / 2 - (j * 10), height, 6, -audiheighteight);

                }

                window.requestAnimationFrame(draw);

        })();

        canv.onclick = () => aud.paused ? aud.play() : aud.pause();

})();


</script>

辫子哥哥 发表于 2023-12-22 12:26

这个美女不怕冷{:4_170:}

辫子哥哥 发表于 2023-12-22 12:27

{:4_199:}

辫子哥哥 发表于 2023-12-22 13:45

不管你等谁,反正不是我{:4_170:}

红影 发表于 2023-12-22 15:31

漂亮的响应式频谱,还有漂亮雪花飘落。其实这样的雪更好,很有立体感呢{:4_199:}

红影 发表于 2023-12-22 15:31

欣赏亚伦老师好帖{:4_187:}

幸运草 发表于 2023-12-22 17:49

好听又好看{:6_244:}

焱鑫磊 发表于 2023-12-22 20:21

辫子哥哥 发表于 2023-12-22 12:26
这个美女不怕冷

辫子哥哥:这个美女很怕冷呢,厚厚的围巾围起来了。{:4_170:}
页: [1]
查看完整版本: 你来与不来我都在等你