亚伦影音工作室 发表于 2024-3-11 06:42

人生上半场 - 赵洋

本帖最后由 亚伦影音工作室 于 2025-1-14 19:53 编辑 <br /><br /><style type="text/css">
#papa{
        position: relative;
        width: 1164px;
        height: 640px;
      margin-left:-300px;
        margin-top:140px;
        border: 0px solid rgba(36, 201, 219,.95);
      border-radius: 10px;
        background:url(https://)no-repeat center/cover,linear-gradient(40deg, #000000, #00ff00, #000080, #ff0000);
        overflow: hidden;
}
#prog { position: absolute; bottom: 550px;left:65px; width: 280px; height: 5px; background: linear-gradient(to right, #880000, #880000 var(--prg), white 0); color: snow; display: grid; place-items: center; --prg: 0%; --state: paused;border-radius: 2px;}
#prog::before, #prog::after { position: absolute;color: #ffffff; font:normal 1em 华文新魏;}
#prog::before { content: attr(data-cu); left:-45px; top: -5px; }
#prog::after { right: -45px; content: attr(data-du); ; top: -5px; }
#slider { position: absolute; width: 6px; height: 6px; background: #cccccc;box-shadow: 0px 0px 0px 4px #880000; left: var(--prg); border-radius: 50%; }
#btnplay { position: absolute; top: -70px; width: 50px; height: 50px; background: url('https://pic.imgdb.cn/item/65141b72c458853aef4cff4a.png') no-repeat center/cover; cursor: pointer; animation: rot 6s infinite linear var(--state); }
@keyframes rot { to { transform: rotate(1turn); filter: hue-rotate(360deg);} }
.photo {width: 1164px; height: 640px;
position: absolute;
top:0%; left:0%;
opacity: 0;
animation: round 90s linear infinite;}
@keyframes round{


0% {
opacity: 1;-webkit-mask-image: radial-gradient(black 5% ,transparent 15%);
-webkit-transform:translate(0%,0%)scale(1)
}

6% {
opacity: 1;-webkit-mask-image: radial-gradient(black 25% ,transparent 75%);
-webkit-transform:translate(0%,0%)scale(1)
}


8% {
opacity: 1;-webkit-mask-image: radial-gradient(black 45% ,transparent 85%);
-webkit-transform:translate(0%,0%)scale(1);
}


9% {-webkit-mask-image: radial-gradient(black 100% ,transparent 100%);
-webkit-transform:translate(0%,0%)scale(1);
opacity: 0;}
}
.photo:nth-child(1) {animation-delay: 84s;background: url('https://pic.imgdb.cn/item/65db15889f345e8d03a7d9b2.jpg')no-repeat center/cover}
.photo:nth-child(2) {animation-delay: 78s;background: url(https://pic.imgdb.cn/item/65db15639f345e8d03a787ea.jpg)no-repeat center/cover}
.photo:nth-child(3) {animation-delay: 72s;background: url(https://pic.imgdb.cn/item/65db15639f345e8d03a78720.jpg)no-repeat center/cover}
.photo:nth-child(4) {animation-delay: 66s;background: url(https://pic.imgdb.cn/item/65db15629f345e8d03a78591.jpg)no-repeat center/cover}
.photo:nth-child(5) {animation-delay: 60s;background: url(https://pic.imgdb.cn/item/65db13539f345e8d03a32d0b.jpg)no-repeat center/cover}
.photo:nth-child(6) {animation-delay: 54s;background: url(https://pic.imgdb.cn/item/65db13fa9f345e8d03a48992.jpg)no-repeat center/cover}
.photo:nth-child(7) {animation-delay: 48s;background: url(https://pic.imgdb.cn/item/65db12cb9f345e8d03a20693.jpg)no-repeat center/cover}
.photo:nth-child(8) {animation-delay: 42s;background: url(https://pic.imgdb.cn/item/65dac8db9f345e8d03eac742.jpg)no-repeat center/cover}
.photo:nth-child(9) {animation-delay: 36s;background: url(https://pic.imgdb.cn/item/65bb5ce1871b83018a3ed949.jpg)no-repeat center/cover}
.photo:nth-child(10){animation-delay: 30s;background: url(https://pic.imgdb.cn/item/65b8fae0871b83018a629f5a.jpg)no-repeat center/cover}
.photo:nth-child(11){animation-delay: 24s;background: url(https://pic.imgdb.cn/item/65b8fa8e871b83018a610f7f.jpg)no-repeat center/cover}
.photo:nth-child(12){animation-delay: 18s;background: url(https://pic.imgdb.cn/item/658d7b30c458853aefc07335.jpg)no-repeat center/cover}
.photo:nth-child(13){animation-delay: 12s;background: url(https://pic.imgdb.cn/item/658c0a24c458853aef9d89ab.jpg)no-repeat center/cover}
.photo:nth-child(14) {animation-delay: 6s;background: url('https://pic.imgdb.cn/item/658c09d6c458853aef9c646b.jpg')no-repeat center/cover}
.photo:nth-child(15) {animation-delay: 0s;background: url('https://pic.imgdb.cn/item/658c1095c458853aefb7e2e9.jpg')no-repeat center/cover}
.stop .photo:nth-child(1),
.stop .photo:nth-child(2),
.stop .photo:nth-child(3),
.stop .photo:nth-child(4),
.stop .photo:nth-child(5),
.stop .photo:nth-child(6),
.stop .photo:nth-child(7),
.stop .photo:nth-child(8),
.stop .photo:nth-child(9),
.stop .photo:nth-child(10),
.stop .photo:nth-child(11),
.stop .photo:nth-child(12),
.stop .photo:nth-child(13),
.stop .photo:nth-child(14),
.stop .photo:nth-child(15){animation-play-state: paused;}

#lrc {
        --motion: cover2;
        --tt: 1s;
        position: absolute;
        left: 50%;
        top: 85%;
        transform: translate(-50%, 0px)skew(0deg);
                font:normal 4em 华文隶书;
        color:#0000;
        filter:hue-rotate(0deg)contrast(120%)brightness(200%);
        filter: drop-shadow( 2px 2px 0px #ffffff);
        z-index: 2;
       
}

#lrc::before {
        position: absolute;
        content: attr(data-lrc);
        width: 20%;
        height: 100%;
        color: transparent;
        overflow: hidden;
        white-space: pre;
        background:#E00000 ;
        filter: drop-shadow( 0px 0px 1px #ffffff)drop-shadow( 0px 0px 1px #ffffff)drop-shadow( 0px 0px 1px #ffffff)drop-shadow( 0px 0px 1px #ffffff);
        -webkit-background-clip: text;
        animation: var(--motion) var(--tt) linear forwards;
        animation-play-state: var(--state);
        }   

@keyframes cover1{
        0% { width: 300%;letter-spacing: 0px; height: 0;transform: skew(0deg);color:#000080;}
        to { width: 300%;height: 300%;transform: skew(0deg);}
}
@keyframes cover2 {
        0% { width: 300%;letter-spacing: 0px; height: 0; transform: skew(0deg);color:#000080;}
        100% { width: 300%; height: 300%; transform: skew(0deg)}
}

</style >
<div id="papa" >
<div id="testImg" >
<pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p><pclass="photo"></p>
</div>
<audio autoplay="" id="aud" loop="" src="https://www.qqmc.com/mp3/music335271228.mp3">&nbsp;</audio>
<div id="prog" data-cu="00:00" data-du="00:00" title="调节进度">
      <span id="btnplay" title="播放/暂停"></span>
      <span id="slider"></span>
    </div>
<div data-lrc="亚伦影音工作室" id="lrc" title="歌词显示">亚伦影音工作室</div>
</div>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `人生上半场 - 赵洋
词:张俊英
曲:赵洋
编曲:可心文化娱乐工作室
混音:可心文化娱乐工作室
制作人:YALUN
监制:赵润泽
出品:YALUN YINHUA
回想这些年受过的伤
眼泪情不自禁往下淌
为了生活天南地北闯
我已不再是当年模样
这些年经历太多沧桑
已经学会把心事隐藏
为了养家常在外飘荡
始终找不到停靠的港
不知不觉人生已过上半场
还能留得住多少的时光
许下的理想够不够喂养
是不是就这样匆匆收场
不知不觉人生已过上半场
多少梦想没有来日方长
脚下的路可不可以丈量
是不是就这样草草散场
这些年经历太多沧桑
已经学会把心事隐藏
为了养家常在外飘荡
始终找不到停靠的港
不知不觉人生已过上半场
还能留得住多少的时光
许下的理想够不够喂养
是不是就这样匆匆收场
不知不觉人生已过上半场
多少梦想没有来日方长
脚下的路可不可以丈量
是不是就这样草草散场
不知不觉人生已过上半场
还能留得住多少的时光
许下的理想够不够喂养
是不是就这样匆匆收场
不知不觉人生已过上半场
多少梦想没有来日方长
脚下的路可不可以丈量
是不是就这样草草散场
是不是就这样草草散场`;

/*变量 :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'),mplayer.style.animationPlayState = 'paused') : (lrc.style.setProperty('--state','running'),mplayer.style.animationPlayState = '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>
<script>
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 = () => prog.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('pause', mState, false);
aud.addEventListener('play', mState, false);
aud.addEventListener('timeupdate', () => { prog.style.setProperty('--prg', aud.currentTime / aud.duration * 100 + '%'); prog.dataset.cu = toMin(aud.currentTime); prog.dataset.du = toMin(aud.duration); });
btnplay.onclick = (e) => { e.stopPropagation(); aud.paused ?( aud.play(),vid.play() ):( aud.pause(),vid.pause()); }
prog.onclick = (e) => aud.currentTime = e.offsetX * aud.duration / prog.offsetWidth;
vid=document.querySelector('#vid');
(function(){
var image = document.getElementById("testImg");
let mState = () => aud.paused ? (image.classList.add('stop')):(image.classList.remove('stop'));
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
})();
</script>


页: [1]
查看完整版本: 人生上半场 - 赵洋