焱鑫磊 发表于 2023-8-18 22:05

《孤独的煎熬忘情的汤》王爱华

本帖最后由 焱鑫磊 于 2023-8-24 16:17 编辑 <br /><br /><style>
#papa { margin: 100px -300px ;width: 1200px;box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 6px #880000; overflow: hidden;height: 640px;border: 1px solid;background: #333 ; position: relative;z-index: 12345; }

.photo {width: 100%;
height: 100%;
position: absolute;z-index: 1;
top:0px; left:0px;
opacity: 0;
animation: round 270s linear infinite;}
@keyframes round{
0% {
-webkit-transform:rotate(0)scale(1)translate(0%,0%);
opacity:0}
2% {
-webkit-transform:rotate(0)scale(1.5)translate(-10%,0%);
opacity:1}
4% {
-webkit-transform:rotate(0)scale(1.5)translate(0%,10%)rotateZ(0deg);
opacity:1}
6% {
-webkit-transform:rotate(0)scale(1.5)translate(0%,-10%)rotateZ(0deg);
opacity:1}
8% {
-webkit-transform:rotate(0)scale(1.5)translate(10%,0%)rotateZ(0deg);
opacity:1}
10% {
-webkit-transform:rotate(0deg)scale(1.5)translate(0%,0%)rotateZ(0deg);
opacity:0}
}
img:nth-child(1) {animation-delay: 252s;}
img:nth-child(2) {animation-delay: 234s;}
img:nth-child(3) {animation-delay: 216s;}
img:nth-child(4) {animation-delay: 198s;}
img:nth-child(5) {animation-delay: 180s;}
img:nth-child(6) {animation-delay: 162s;}
img:nth-child(7) {animation-delay: 144s;}
img:nth-child(8) {animation-delay: 126s;}
img:nth-child(9) {animation-delay: 108s;}
img:nth-child(10){animation-delay: 90s;}
img:nth-child(11){animation-delay: 72s;}
img:nth-child(12){animation-delay: 54s;}
img:nth-child(13){animation-delay: 36s;}
img:nth-child(14) {animation-delay: 18s;}
img:nth-child(15) {animation-delay: 0s;}
.stop img:nth-child(1),
.stop img:nth-child(2),
.stop img:nth-child(3),
.stop img:nth-child(4),
.stop img:nth-child(5),
.stop img:nth-child(6),
.stop img:nth-child(7),
.stop img:nth-child(8),
.stop img:nth-child(9),
.stop img:nth-child(10),
.stop img:nth-child(11),
.stop img:nth-child(12),
.stop img:nth-child(13),
.stop img:nth-child(14),
.stop img:nth-child(15){animation-play-state: paused;}
#dt{position: absolute;top:0%; left:0%;width: 100%;height: 100%;mix-blend-mode: lighten;z-index: 3; transform: rotateX(0deg);}
#prog { position: absolute; bottom: 20px; width: 280px; height: 12px; background: linear-gradient(to right, snow var(--prg), gray 0) repeat-x 0 50% / 100% 1px;left:40%; color: snow; display: grid; place-items: center; --prg: 0%; --state: paused; z-index: 999;}
#prog::before, #prog::after { position: absolute; top: -30px; }
#prog::before { content: attr(data-cu); left: 0; }
#prog::after { right: 0; content: attr(data-du); }
#slider { position: absolute; width: 3px; height: 7px; background: snow; left: var(--prg); }
#btnplay { position: absolute; top: -20px;font: normal 3.3em/0em serif;
color:#ffffff; cursor: pointer; animation: rot 6s infinite linear var(--state); }
@keyframes rot { to { transform: rotate(1turn); } }
#lrc {
      --state: paused;
      --motion: cover2;
      --tt: 2s;
      --bg: linear-gradient(0deg, #ff0000, #ff0000, #ff0000);
      position: absolute;z-index: 6;
      left: 52%;
      transform: translate(-50%);
      top: 75%;
      font:normal 3em 华文新魏;
      font-weight:800;
      color: #0000;
      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{   0% { width: 100%;transform:rotate(0deg)scale(0)}100% { width: 100%;transform:rotate(0deg)scale(1);filter:hue-rotate(360deg)}}
@keyframes cover2 {    0% { width: 100%;transform:rotate(0deg)scale(0)}100% { width: 100%;transform:rotate(0deg)scale(1);filter:hue-rotate(360deg)}}

#papa:hover #fullscreen { display:block ;}
#fullscreen { position: absolute; top:5%; left:83%;color:#ffffff; filter:drop-shadow( 1px 1px 1px #000000);font: normal 2.2em华文隶书; opacity: 1; cursor: pointer; z-index: 1111}
</style>

<div id="papa">
<span id="fullscreen">全屏观赏</span>
<div id='dt'><img id="Img" src="https://pic.imgdb.cn/item/6412e67aebf10e5d530a990b.gif" width="100%" height="100%"></div>
<div id="testImg" >
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4916661c6c8e54b28264.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4917661c6c8e54b282f7.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4917661c6c8e54b28360.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4917661c6c8e54b2840b.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4917661c6c8e54b28496.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4937661c6c8e54b2d435.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4937661c6c8e54b2d468.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4937661c6c8e54b2d4a9.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4937661c6c8e54b2d52c.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4937661c6c8e54b2d5ac.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4916661c6c8e54b28264.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4917661c6c8e54b282f7.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4917661c6c8e54b28360.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4917661c6c8e54b2840b.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64df4917661c6c8e54b28496.jpg" />
</div>

<div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
    <div id="prog" data-cu="00:00" data-du="00:00" title="调节进度">
       <span id="btnplay" title="播放/暂停"> <P id="btn" >❊</p></span>
         <span id="slider"></span>
    </div>
</div>
<audio id="aud" src="https://i.mp3.wf/view.php/5cabcd98c4834fbeaa5e6f95cd640020.mp3" autoplay loop></audio>

<script>
let toMin = (val) => { if (!val) return '00:00'; let min = parseInt(val / 60), sec = parseFloat(Math.floor(val) % 60); 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() : aud.pause(); }
prog.onclick = (e) => aud.currentTime = e.offsetX * aud.duration / prog.offsetWidth;
</script>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `
《孤独的煎熬忘情的汤》王爱华
词/曲:三力
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'),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); /*获得歌词数组*/
})();

let fs = true;
      fullscreen.onclick = () => {
                fs ? (fullscreen.innerText = '退出全屏',papa.requestFullscreen()) : (fullscreen.innerText = '全屏观赏', document.exitFullscreen());
                fs = !fs;
      };
</script>
<script>
if ('getContext' in document.createElement('canvas')) {
    HTMLImageElement.prototype.play = function() {
      if (this.storeCanvas) {
            // 移除存储的canvas
            this.storeCanvas.parentElement.removeChild(this.storeCanvas);
            this.storeCanvas = null;
            // 透明度还原
            imagee.style.opacity = '';
      }
      if (this.storeUrl) {
            this.src = this.storeUrl;   
      }
    };
    HTMLImageElement.prototype.stop = function() {
      var canvas = document.createElement('canvas');
      // 尺寸
      var width = this.width, height = this.height;
      if (width && height) {
            // 存储之前的地址
            if (!this.storeUrl) {
                this.storeUrl = this.src;
            }
            // canvas大小
            canvas.width = width;
            canvas.height = height;
            // 绘制图片帧(第一帧)
            canvas.getContext('2d').drawImage(this, 0, 0, width, height);
            // 重置当前图片
            try {
                this.src = canvas.toDataURL("image/gif");
            } catch(e) {
                // 跨域
                this.removeAttribute('src');
                // 载入canvas元素
                canvas.style.position = 'absolute';
                // 前面插入图片
                this.parentElement.insertBefore(canvas, this);
                // 隐藏原图
                this.style.opacity = '0';
                // 存储canvas
                this.storeCanvas = canvas;
            }
      }
    };
}

var image = document.getElementById("testImg"),
imagee = document.getElementById("Img"),
    button = document.getElementById("btn");
   
if (image.classList && button) {
    button.onclick = function() {
      if (this.value == '.') {
            image.classList.remove('stop');imagee.play();
          this.value = '*';
      } else {
            image.classList.add('stop');imagee.stop();
            this.value = '.';
      }
    };
}
</script>

千羽 发表于 2023-8-18 22:27

焱鑫磊做得特效图好美,自然流畅,歌儿也好听{:4_187:}

红影 发表于 2023-8-18 22:34

漂亮的画面,优美的歌儿。欣赏焱鑫磊好帖{:4_199:}

焱鑫磊 发表于 2023-8-19 08:54

千羽 发表于 2023-8-18 22:27
焱鑫磊做得特效图好美,自然流畅,歌儿也好听

问候千羽好!{:4_187:}

焱鑫磊 发表于 2023-8-19 08:54

红影 发表于 2023-8-18 22:34
漂亮的画面,优美的歌儿。欣赏焱鑫磊好帖

谢谢美女夸奖!{:4_187:}

红影 发表于 2023-8-19 10:19

焱鑫磊 发表于 2023-8-19 08:54
谢谢美女夸奖!

问好焱鑫磊,周六快乐{:4_187:}
页: [1]
查看完整版本: 《孤独的煎熬忘情的汤》王爱华