|
楼主 |
发表于 昨天 14:53
|
显示全部楼层
IP:澳大利亚
- <div style="position: absolute; left:20px;width:100%;margin-top:-20px;">
- <style>
- #papa { margin: 150px 0 20px calc(50% - 621px); background:#800 url(' ')no-repeat center/cover;width: 1164px; height: 700px; box-shadow: 3px 3px 6px gray; overflow: hidden; z-index: 1; position: relative; display: grid; place-items: center; }
- #mdiv {z-index: 10;
- --size: 0px;
- --color: teal;
- position: relative;
- left: calc(-35% - var(--size) / 2);
- top: 230px;
- width: var(--size);
- height: var(--size);
- display: grid;
- place-items: center;
- animation: rot 8s linear infinite ;
- cursor: pointer;
- }
- #mdiv::before, #mdiv::after {
- position: absolute;
- content: '';
- width: 0;
- height: 0;
- border-style: solid;
- border-width: calc(var(--size) / 2) calc(var(--size) / 2 - 35px);
- border-color: var(--color) transparent;
-
- border-radius: 100% 100% 100% 100%;
- filter:drop-shadow(#000 1px 0 0)drop-shadow(#000 0 1px 0)drop-shadow(#000 -1px 0 0) drop-shadow(#000 0 -1px 0);
- }
- #mdiv::after { transform: rotate(90deg) }
- @keyframes rot { 100% { transform: rotate(360deg);filter:hue-rotate(360deg); } }
- #vid {z-index: 2;
- position: absolute;
- width: 100%;
- height: 100%;
- object-fit: cover;
- -webkit-mask-image: radial-gra**nt(black 10% ,transparent 90%);
- }
- #vido {z-index: 1;
- position: absolute;
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- #fullscreen { position: absolute; top: 30px; right:30px;font: normal 2em/0em 楷体;color:#000; opacity: 1; cursor: pointer; z-index: 111}
- </style>
- <div id="papa">
- <div id="mdiv" title=""></div>
- <div data-lrc=" " id="lrc" title="歌词显示"> </div>
- <span id="fullscreen">全屏欣赏</span>
- <audio id="aud" src="https://link.hhtjim.com/163/26599625.mp3" autoplay loop></audio>
- <video id="vid" src=" " autoplay loop muted></video>
- <video id="vido" src="
- https://alimov2.a.kwimgs.com/upic/2025/09/06/10/BMjAyNTA5MDYxMDQ4NDFfNDYzNDgzODgwOF8xNzQzMTY0MTM1NDlfMl8z_b_B781fa40e9a5090232b29b71cf1dba1ec.mp4
- " autoplay loop muted></video>
- </div>
-
-
- <script>
- mdiv.onclick = () => aud.paused ?( aud.play(),vid.play(),vido.play()):(aud.pause(),vid.pause(),vido.pause());
- mdiv.style.animationPlayState = aud.paused ? 'paused' : 'running';
- aud.addEventListener('playing', () =>mdiv.style.animationPlayState = 'running');
- aud.addEventListener('pause', () =>mdiv.style.animationPlayState = 'paused');
- let fs = true;
- fullscreen.onclick = () => {
- fs ? (fullscreen.innerText = '退出全屏', papa.requestFullscreen()) : (fullscreen.innerText = '全屏欣赏', document.exitFullscreen());
- fs = !fs;
- };
- </script>
- <style type="text/css">
- #lrc {--state: paused;--motion: cover2;--tt: 2s;--bg: linear-gra**nt(0deg, #880000, #880000, #880000);
- position: absolute;z-index: 6;left: 50%; top: 85%;transform: translate(-50%);font:normal 3em 华文新魏; font-weight:400;color: #000080;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 -1px 0);}
- #lrc::before {position: absolute;content: attr(data-lrc);width: 100%; height: 100%;color: transparent;overflow: hidden;white-space: pre;background: var(--bg);clip-path: inset(0 100% 0 0);-webkit-background-clip: text;animation: var(--motion) var(--tt) linear forwards;animation-play-state: var(--state);}
- @keyframes cover1{ to { clip-path: inset(0 0 0 0); } }@keyframes cover2 { to { clip-path: inset(0 0 0 0); } }
- </style>
- <script >
- (function() {
- /*原始lrc歌词*/
- let lrcStr = `[00:00.00] 爱上草原爱上你:琪琪格
-
-
- [00:11.50]LRC歌词:竹海人家
- [00:23.57]那是谁的画笔 蘸满了绿色
- [00:27.89]那是谁的心动 像盛开的花朵
- [00:32.12]你的大眼睛 藏着一首歌
- [00:36.34]听醉了一弯溪水听醉了我
- [00:40.60]那是谁的浪漫 蓝的像童话
- [00:44.68]那是谁的笑声 洗白了云朵
- [00:48.82]我的幸福就像花儿一样
- [00:53.12]一夜被风撒遍满山满坡
- [00:57.36]爱上草原爱上你
- [01:01.48]爱上这晴朗的好天气
- [01:05.81]爱上你的诗情和画意
- [01:09.93]爱上这份纯净清澈见底
- [01:14.23]爱上草原爱上你
- [01:18.32]爱上这简单让我着迷
- [01:22.52]爱上爱你这真实的感觉
- [01:26.70]让我走进你的梦里 和你在一起
- [01:33.34] 让风儿吹来花开的消息
- [01:35.51]让月儿知道我在等着你
- [01:37.64]总以为惯疲倦和拥挤
- [01:39.89]一路奔跑让我忘记自己
- [01:41.60]爱上草原爱上你
- [01:45.75]
- [01:49.75]那是谁的画笔 蘸满了绿色
- [01:54.08]那是谁的心动 像盛开的花朵
- [01:58.32]你的大眼睛 藏着一首歌
- [02:02.52]听醉了一弯溪水听醉了我
- [02:06.75]那是谁的浪漫 蓝的像童话
- [02:10.95]那是谁的笑声 洗白了云朵
- [02:15.12]我的幸福就像花儿一样
- [02:19.41]一夜被风撒遍满山满坡
- [02:23.58]爱上草原爱上你
- [02:27.82]爱上这晴朗的好天气
- [02:31.97]爱上你的诗情和画意
- [02:36.17]爱上这份纯净清澈见底
- [02:40.40]爱上草原爱上你
- [02:44.71]爱上这简单让我着迷
- [02:48.74]爱上爱你这真实的感觉
- [02:53.04]让我走进你的梦里 和你在一起
- [02:59.13]爱上草原爱上你
- [03:03.39]爱上这晴朗的好天气
- [03:07.67]爱上你的诗情和画意
- [03:11.81]爱上这份纯净清澈见底
- [03:16.16]爱上草原爱上你
- [03:20.28]爱上这简单让我着迷
- [03:24.58]爱上爱你这真实的感觉
- [03:28.69]让我走进你的梦里 和你在一起
- `;
- /*变量 :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[j] = parseFloat((ar[j+1][0] - ar[j][0]).toFixed(1));}
- let aver = parseInt(tmpAr.reduce((a,b) => a + b) / (tmpAr.length - 1)) + averAdd;
- tmpAr.push(aver);
- tmpAr.forEach((item,key) => {ar[key][2] = item > aver ? aver : item; });
- return ar;};
- /*函数 :从原始lrc歌词获取信息并存入 n*3 数组*/
- let getLrcAr = (text) => {
- let lrcAr = [];
- let calcRule = [60,1,0.001];
- 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[z] * calcRule[z];
- ar[0] = [parseFloat(sec.toFixed(2)), geci];
- lrcAr.push(ar[0]);
- }
- }
- }
- }
- lrcAr.sort((a,b)=> a[0] - b[0]);
- return(lrcTime(lrcAr));
- };
- /*函数 :模拟显示同步歌词*/
- let showLrc = (time) => {
- let name = mFlag ? 'cover1' : 'cover2';
- lrc.innerHTML = lrcAr[mKey][1];
- lrc.dataset.lrc = lrcAr[mKey][1];
- 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[j][0]) {
- mKey = j - 1;
- break;
- }
- }
- if (mKey < 0) mKey = 0;
- if (mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;
- let time = lrcAr[mKey][2] - (aud.currentTime - lrcAr[mKey][0]);
- 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'),mdiv.style.animationPlayState = 'paused') : (lrc.style.setProperty('--state','running'),mdiv.style.animationPlayState = 'running');
- /*监听播放进度*/
- aud.addEventListener('timeupdate', () => {
- for (j = 0; j < lrcAr.length; j++) {
- if (aud.currentTime >= lrcAr[j][0]) {
- cKey = j;
- if (mKey === j) showLrc(lrcAr[j][2]);
- else continue;
- }
- }
- });
- aud.addEventListener('pause', () => mState());/*监听暂停事件*/
- aud.addEventListener('play', () => mState());/*监听播放事件*/
- aud.addEventListener('seeked', () => calcKey());/*监听查询事件*/
- let lrcAr = getLrcAr(lrcStr); /*获得歌词数组*/
- })();
- </script>
- </div>
- <div style="height:660px;"></div>
- <br /><br /><br /><br /><br /><br /><br /><br />
- </td></tr>
复制代码 |
|