蓝鸟 发表于 2023-9-3 13:11:10

草原轻音乐电子琴20分钟

<style>
#papa { margin: 0 0 0 calc(50% - 593px); width: 1200px; height: 720px; background: url('https://ln2018.oss-cn-hangzhou.aliyuncs.com/cs/bj.jpg') no-repeat center/cover; box-shadow: 4px 4px 8px black; overflow: hidden; display: grid; place-items: center; z-index: 1; position: relative; --state: running; }

#vid { position: absolute; width: 100%; height: 100%; top: -30px; object-fit: cover; opacity: 1;auto;filter:contrast(120%);transform: scale(1.1, 1.1) }

#photo img {
        width: 1024px;
        height: 640px;
        position: absolute;
        border: 0px solid #000000;
        top: 0px;
        left: 00px;
        filter: contrast(150%)brightness(100%);
      -webkit-mask-image:radial-gradient(black 25%,transparent 70%);
      opacity: 0;
        animation-name: round;
        animation-duration: 48s;
        animation-iteration-count: infinite;
        animation-timing-function: linear;
}
@keyframes round {
0% { opacity: 0; transform:translate(0%,0%)scale(0);}
5% { opacity: 1; transform:translate(0%,0%)scale(0);}
14% { opacity: 1; transform:translate(0%,0%)scale(1);}
16% { opacity: 1; transform:translate(0%,0%)scale(1);}
24% { opacity: 0; transform:translate(100%,0%)scale(1);}
}
#photo img:nth-child(8) { animation-delay: 42s; }
#photo img:nth-child(7) { animation-delay: 36s; }
#photo img:nth-child(6) { animation-delay: 30s; }
#photo img:nth-child(5) { animation-delay: 24s; }
#photo img:nth-child(4) { animation-delay: 18s; }
#photo img:nth-child(3) { animation-delay: 12s; }
#photo img:nth-child(2) { animation-delay: 6s; }
#photo img:nth-child(1) { animation-delay: 0s; }

#vid { position: absolute; width: 100%; height: 720px; top: -55px; object-fit: cover; pointer-events: none; mix-blend-mode: screen; z-index: 10; opacity: .15; }

</style>
<div id="img_border"></div>
<divid="photo">
<div id="papa">
<video id="vid" src="mp4" autoplay="" loop="" muted="" bd_landing_video_statistic_record_key="1"></video>
<img class="photo" src="https://pic.imgdb.cn/item/64f0af8c661c6c8e541cacd3.jpg" /> <img class="photo" src="https://pic.imgdb.cn/item/64f0afbd661c6c8e541cb94b.jpg" /> <img class="photo" src="https://pic.imgdb.cn/item/64f0afda661c6c8e541cbe2e.jpg" /> <img class="photo" src="https://pic.imgdb.cn/item/64f0b012661c6c8e541cc6db.jpg" /> <img class="photo" src="https://pic.imgdb.cn/item/64f0b04f661c6c8e541cd374.jpg" /> <img class="photo" src="https://pic.imgdb.cn/item/64f0b06d661c6c8e541cd83d.jpg" /> <img class="photo" src="https://pic.imgdb.cn/item/64f0b0e7661c6c8e541cee68.jpg" /> <img class="photo" src="https://pic.imgdb.cn/item/64f0b0f6661c6c8e541cf12d.jpg" />
</div>
<audio id="aud" crossorigin="anonymous" src="https://shanlr.s3-us-east-1.ossfiles.com/yu/dzq.mp3" autoplay loop></audio>
<script>
      
(function() {
        let script = document.createElement('script');
        script.src = 'https://ln2018.oss-cn-hangzhou.aliyuncs.com/2023/ss/ssxypp_lrc.js';
        script.charset = 'utf-8';
        document.head.appendChild(script);
      let geci = [
       
];
      script.onload = () => {
                HCPlayer({
                        papa: '#papa',
                        lrcAr: geci,
                        lrc_css: 'filter:drop-shadow(#ffffff 1px 0 0)drop-shadow(#ffffff 0 1px 0)drop-shadow(#ffffff -1px 0 0) drop-shadow(#ffffff 0 -1px0);font-family:华文隶书;   --bg: #000080;top: 10px; color: #ff0000;',
                        fs_css: ' background: BlueViolet; color: GhostWhite; top: 69%; right: 16.5%; ',
                        player_css: `
                              bottom: 6.2%;
                right: 5.9%;
                              --discBg:url('https://pic.imgdb.cn/item/6430f41f0d2dde577706d0ec.png') no-repeat center/cover;
                              --discSize: 40px;
                              --hh: 120px;
                        `,
                     player_css: `
                               bottom: 20px;
                                --ww: 1160px;
                                --color1: LightSkyBlue;
                                --color2: LightCyan;
                                --track: #ccc;
                        `,
                       
pinpu: { size: 5, gap: 1},
               fs_css: 'background: Gray; color: GhostWhite;',
                        pinpu_num: 120,
                });
      };
})();
img_border.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>img_border.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>img_border.style.animationPlayState = 'paused');

</script>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `草原轻音乐电子琴20分钟
山里人编辑
2023.9.3
电子琴纯音乐
电子琴纯音乐
草原轻音乐电子琴20分钟

`;

/*变量 :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>

页: [1]
查看完整版本: 草原轻音乐电子琴20分钟