小辣椒 发表于 2025-5-6 21:56

去年陪你过冬的人现在还在吗 (Live合唱版) - 音宝

<style>
#papa{
        position: relative;
        width: 1286px;
        height: 720px;
         margin: 140px 0 20px calc(50% - 728px);        
        border: 3px solid rgba(36, 201, 219,.95);
      border-radius: 2px;
        background:#000;
        overflow: hidden;--stat: running ;
}

#vid1{width: 100%; height: 100%;z-index: 1;
position:absolute;
top:0%; left:0%;
object-fit: cover; pointer-events: none;
}
.vid{width: 100%; height: 100%;z-index: 2;
position:absolute;
top:0%; left:0%;

opacity: 0;object-fit: cover; pointer-events: none;
animation: round 80s linear infinite var(--stat);}
@keyframes round {1% {opacity: 0;}
5% {
opacity: .6;}
10% {
opacity:.8;}
15% {
opacity:1;}
20% {
opacity: 0;}
}
.vid:nth-child(1){animation-delay: 72s;}
.vid:nth-child(2){animation-delay: 64s;}
.vid:nth-child(3){animation-delay: 56s;}
.vid:nth-child(4){animation-delay: 48s;}
.vid:nth-child(5){animation-delay: 40s;}
.vid:nth-child(6){animation-delay: 32s;}
.vid:nth-child(7){animation-delay: 24s;}
.vid:nth-child(8){animation-delay: 16s;}
.vid:nth-child(9){animation-delay: 8s;}
.vid:nth-child(10){animation-delay: 0s;}
#mdiv {top:12%; left:5%;cursor: pointer;
        width:200px;text-align:center;animation:rot 10s linear infinite var(--stat);
        position: absolute;filter:drop-shadow(#000 0px 0 1px);
        z-index: 40;
        }
@keyframes rot { to { transform: rotate(2turn);} }
#mdiv:hover {}
#lrc {
      --state: paused;
      --motion: cover2;
      --tt: 2s;
      --bg: #880000;
      position: absolute;z-index: 6;
      left: 50%;
      transform: translate(-50%);
      top: 76%;
      font:normal 2.5em 华文新魏;
color: #000;
      
      
      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{0% { width: 0%;}100% { width: 100%;}}
@keyframes cover2 { 0% { width: 0%;}100% { width: 100%;}}
#fullscreen { position: absolute; bottom:5%; left:47%;font:900 1.6em/0em 微软雅黑;color:#fff; opacity: 1; cursor: pointer; z-index: 111}
</style >
<div id="papa" >
<span id="fullscreen">全屏欣赏</span>

<video id="vid1" src="https://video-qn.51miz.com/preview/video/00/00/16/61/V-166191-5D524C02.mp4" loop muted autoplay=""></video>

<div>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/64/44/V-644497-2AA8E59F.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/vcg/video/preview/51miz42N1337588768.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/64/21/V-642116-F9201003.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/16/61/V-166191-5D524C02.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/64/92/V-649284-0F51DE30.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/60/82/V-zip-20230301_DV_236-A4FE233A.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/64/26/V-642660-2AF8E09D.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/64/97/V-649701-EB71C04C.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/64/07/V-640739-530482F4.mp4" loop muted autoplay></video>
<video class="vid" src="https://video-qn.51miz.com/preview/video/00/00/13/79/V-137992-59E8E7DE.mp4" loop muted autoplay></video>
</div>
<audio id="aud" src="https://aod.cos.tx.xmcdn.com/storages/09f7-audiofreehighqps/37/A3/GKwRIJIJUr1cACAAAAKMvD_D.m4a" autoplay loop></audio>
<div id="mdiv">
        <svg width="100" height="100" viewBox="-160 -160 320 320">
        <defs>
                <filter id="shadow">
                        <feDropShadow dx="0" dy="0" stdDeviation="1" flood-color="black"></feDropShadow>
                </filter>
                <g id="part" filter="url(#shadow)">
                        <line x1="0" y1="-100" x2="0" y2="100" stroke="#880" stroke-width="4"></line>
                        <ellipse cx="0" cy="-125" rx="20" ry="20" fill="#fff"></ellipse>
                        <ellipse cx="0" cy="125" rx="20" ry="20" fill="#fff"></ellipse>
                </g>
        </defs>
        <use href="#part"></use>
        <use href="#part" transform="rotate(35)"></use>
        <use href="#part" transform="rotate(70)"></use>
        <use href="#part" transform="rotate(105)"></use>
        <use href="#part" transform="rotate(140)"></use>
</svg>
</div>
<div data-lrc="视频转场效果" id="lrc">视频转场效果</div>
</div>

<script>
(function() {
      const vids = document.querySelectorAll('.vid');
      var mState = () => {papa.style.setProperty('--stat', aud.paused ? 'paused' : 'running');
         vids.forEach(vid => aud.paused ? vid.pause() : vid.play());
      };
      aud.onplaying = aud.onpause = () => mState();
      })();

mdiv.onclick = () => aud.paused ? (aud.play(),vid1.play()): (aud.pause(),vid1.pause());
let fs = true;
      fullscreen.onclick = () => {
                fs ? (fullscreen.innerText = '退出全屏',papa.requestFullscreen()) : (fullscreen.innerText = '全屏欣赏', document.exitFullscreen());
                fs = !fs;
      };
</script>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `那个去年陪你过冬的人
她现在还在吗
[00:09.32演唱:音宝
词:音宝
曲:音宝
天空飘起雪花我又想你了
思念的眼泪悄然落下
曾说陪我到老的你啊
如今过得还好吧
时间给了爱真实的回答
三观不同的人最后都散了
那些说过动人的诺言啊
后来换另一个人实现了
那个去年陪你过冬的人
她现在还在吗
天冷了你是否会牵挂
曾经深爱过的她
那个去年陪你过冬的人
她现在还在吗
是不是已经成了家
还是彼此相望在天涯
LRC编辑:小辣椒
时间给了爱真实的回答
三观不同的人最后都散了
那些说过动人的诺言啊
后来换另一个人实现了
那个去年陪你过冬的人
她现在还在吗
天冷了你是否会牵挂
曾经深爱过的她
那个去年陪你过冬的人
她现在还在吗
是不是已经成了家
还是彼此相望在天涯
那个去年陪你过冬的人
她现在还在吗
天冷了你是否会牵挂
曾经深爱过的她
那个去年陪你过冬的人
她现在还在吗
是不是已经成了家
还是彼此相望在天涯
谢谢欣赏

`;

/*变量 :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); /*获得歌词数组*/
})();
</script>

小辣椒 发表于 2025-5-6 21:57

学习亚纶的代码做一个{:6_174:}

感谢亚纶的代码分享


因为手机看不见上面靠边的全屏欣赏的文字,我移动到下面中间位置了

小辣椒 发表于 2025-5-6 21:58

同一首完成{:5_128:}{:5_128:}

liumang 发表于 2025-5-6 21:59

小辣椒速度完成了{:5_150:}{:5_150:}

小辣椒 发表于 2025-5-6 22:00

liumang 发表于 2025-5-6 21:59
小辣椒速度完成了

晚上好liumang{:5_149:}

liumang 发表于 2025-5-6 22:02

小辣椒 发表于 2025-5-6 22:00
晚上好liumang

小辣椒这个做的效果很好,歌曲好听,配的雪景不错

小辣椒 发表于 2025-5-6 22:07

liumang 发表于 2025-5-6 22:02
小辣椒这个做的效果很好,歌曲好听,配的雪景不错

都是小子分享的音乐,去年分享过一个和这个曲调都不一样,歌曲名称差不多的,我也是已经做过了,他说这首比上次的好听,我就做一次

liumang 发表于 2025-5-6 22:10

小辣椒 发表于 2025-5-6 22:07
都是小子分享的音乐,去年分享过一个和这个曲调都不一样,歌曲名称差不多的,我也是已经做过了,他说这首 ...

别太累,不听他的,有时间,身体好就多做几个,否则多休息{:5_145:}

小辣椒 发表于 2025-5-6 22:37

liumang 发表于 2025-5-6 22:10
别太累,不听他的,有时间,身体好就多做几个,否则多休息

谢谢 liumang,我先下了,明天见{:5_141:}

liumang 发表于 2025-5-6 22:38

小辣椒 发表于 2025-5-6 22:37
谢谢 liumang,我先下了,明天见

拜拜,好好休息{:5_127:}
页: [1]
查看完整版本: 去年陪你过冬的人现在还在吗 (Live合唱版) - 音宝