焱鑫磊 发表于 2023-12-18 17:04

《人生没有回头路》田娥

<style>
#papa {margin: 100px 0 0 calc(50% - 681px); width: 1200px;height:680px;box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 8px #880000; overflow: hidden;place-items: center; position: relative;z-index: 12345;background: #333;}
.photo {width: 100%;
height: 100%;
position: absolute;z-index: -1;
top:0px; left:0px;
opacity: 0;
animation: round 60s linear infinite;-webkit-mask-image: radial-gradient(black 100% ,transparent 100%);}
@keyframes round{
0% {
-webkit-transform:rotate(0)scale(1.5)translate(10%,0%);
opacity:0}
4% {
-webkit-transform:rotate(0)scale(1.5)translate(-10%,0%);
opacity:1}
8% {
-webkit-transform:rotate(0)scale(1.5)translate(0%,10%);
opacity:1}
12% {
-webkit-transform:rotate(0)scale(1.5)translate(0%,-10%);
opacity:1}
16% {
-webkit-transform:rotate(0)scale(1)translate(0%,0%);
opacity:1}
20% {
-webkit-transform:rotate(0deg)scale(1.5)translate(10%,0%);
opacity:1}
22% {
-webkit-transform:rotate(0deg)scale(1.5)translate(10%,0%);
opacity:0}
}
.photo:nth-child(1) {animation-delay: 48s;background: url('https://i.mp3.wf/view.php/2ca4fbdf745a24872f496ed9110efccb.jpg') no-repeat center/cover;}
.photo:nth-child(2) {animation-delay: 36s;background: url('https://i.mp3.wf/view.php/6f8329b18722c4537fa15b791c90588c.jpg') no-repeat center/cover;}
.photo:nth-child(3) {animation-delay: 24s;background: url('https://i.mp3.wf/view.php/11217710c0f2e497bcbb1b32b6e5f942.jpg') no-repeat center/cover;}
.photo:nth-child(4) {animation-delay: 12s;background: url('https://i.mp3.wf/view.php/fddd66c865fab99390c81124f3abb2f0.jpg') no-repeat center/cover;}
.photo:nth-child(5) {animation-delay: 0s;background: url('https://i.mp3.wf/view.php/9797a085d8f2c45daf2dc9fefd273f9c.jpg') no-repeat center/cover;}

.stop .photo:nth-child(1){animation-play-state: paused;}
.stop .photo:nth-child(2){animation-play-state: paused;}
.stop .photo:nth-child(3){animation-play-state: paused;}
.stop .photo:nth-child(4){animation-play-state: paused;}
.stop .photo:nth-child(5){animation-play-state: paused;}
#mplayer { width: 200px; height: 200px; position: absolute; left: 70%;top: 80%;}
#mplayer text { user-select: none; }
#sPath { cursor: pointer; }
#progress { pointer-events: none; }
#btnPlay:hover { cursor: pointer; filter: brightness(1.2); }
#dt{position: absolute;top:0%; left:0%;width: 100%;height: 100%;z-index: -1;mix-blend-mode:lighten;   opacity: 1; }
#lrc { --motion: cover1; --tt: 2s; --state: paused; position: absolute; left: 40%; transform: translate(-50%); top: 84%; font: normal 3em 华文新魏; color:#ff0000; -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:#000080 ; filter: #ffffff; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
@keyframes cover1{0% { width: 0%;filter: hue-rotate(360deg)brightness(150%)}
100% { transform: rotateY(0deg)rotatex(0deg);filter: hue-rotate(0deg)brightness(150%);width: 100%;}
}
@keyframes cover2 { 0% { width: 0%;filter: hue-rotate(360deg)brightness(150%)}
100% { transform: rotateY(0deg)rotatex(0deg);filter: hue-rotate(0deg)brightness(150%);width: 100%;}
}

#fullscreen { position: absolute; top:5%; left:calc(85% - 15px);font: normal 2em/0em 隶书;color:#ffffff; opacity: 1; cursor: pointer; z-index: 111}
</style>
<div id="papa">
<span id="fullscreen">全屏欣赏</span>
<div id="Img" >
<p class="photo" ></p>
<p class="photo" ></p>
<p class="photo" ></p>
<p class="photo" ></p>
<p class="photo" ></p>
</div>

<div id='dt' ><img id="testImg" src="https://pic.imgdb.cn/item/642a50c2a682492fccd831a0.gif" width="100%" height="100%"></div>
<svg id="mplayer">
      <path id="sPath" d="M100 5 Q-50 160 190 5" fill="none" stroke="#ffffff" stroke-width="4"></path>
      <circle id="progress" cx="10" cy="10" r="5" fill="#306b35" />
      <g transform="translate(30,110)" fill="#eee">
                <text id="cu" x="-5" y="0">00:00</text>
                <image id="btnPlay" x="45" y="-30" width="45" height="45" xlink:href="https://i.mp3.wf/view.php/4afbb54e081077e5c3ecbabf7aa514bd.png"></image>
                <text id="du" x="92" y="0">00:00</text>
      </g>
</svg>
<audio id="aud" src="https://www.qqmc.com/up/kwlink.php?id=235528208&.mp3" autoplay loop></audio>
<div id="lrc" data-lrc="HCPlayer">HCPlayer</div>

</div>

<script>
let posAr = [];
let len = sPath.getTotalLength();
let playImg = 'https://i.mp3.wf/view.php/dfa889fa17181a9f8de3585ad701a2ec.png',
      pauseImg = 'https://i.mp3.wf/view.php/4afbb54e081077e5c3ecbabf7aa514bd.png';

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 ? btnPlay.setAttribute('xlink:href',playImg) : btnPlay.setAttribute('xlink:href',pauseImg);

let getMinItem = (ar) => {
      ar.sort((a,b) => a - b);
      return ar;
};

for(i = 0; i < len; i ++) {
      posAr.push(sPath.getPointAtLength(i));
}

sPath.onclick = (e) => {
      let ex = Math.round(e.offsetX), ey = Math.round(e.offsetY), yAr = [];
      for(i = 0; i < len; i ++) {
                let px = Math.round(posAr.x), py = Math.round(posAr.y);
                if(Math.abs(ex-px) <= 4) {
                        yAr.push();
                }
      }
      aud.currentTime = getMinItem(yAr) * aud.duration / len;
};

aud.addEventListener('timeupdate', () => {
      let idx = Math.round(aud.currentTime * len / aud.duration);
      progress.setAttribute('cx',posAr.x);
      progress.setAttribute('cy',posAr.y);
      cu.textContent = toMin(aud.currentTime);
      du.textContent = toMin(aud.duration);
});

aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
btnPlay.onclick = () => aud.paused ? aud.play() : aud.pause();

var imagee= document.getElementById("testImg");
</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')) : (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); /*获得歌词数组*/
})();
btnPlay.onclick = () => aud.paused ? aud.play() : aud.pause();
let fs = true;
      fullscreen.onclick = () => {
                fs ? (fullscreen.innerText = '退出全屏', papa.requestFullscreen()) : (fullscreen.innerText = '全屏欣赏', document.exitFullscreen());
                fs = !fs;
      };

</script>
<script>
(function(){
var image = document.getElementById("Img");
let mState = () => aud.paused ? image.classList.add('stop'): image.classList.remove('stop');
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
})();

</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;
            }
      }
    };
}

(function(){
var imagee = document.getElementById("testImg");
let mState = () => aud.paused ? imagee.stop(): imagee.play();
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
})();

</script>

千羽 发表于 2023-12-18 18:33

很美的特效制作,欣赏学习了,问好焱鑫磊{:4_187:}

红影 发表于 2023-12-18 18:49

这个是黑黑的路径吧,焱鑫磊的制作很漂亮{:4_187:}

红影 发表于 2023-12-18 18:50

图片移动漂亮,歌曲好听。欣赏焱鑫磊好帖{:4_199:}

焱鑫磊 发表于 2023-12-18 19:59

千羽 发表于 2023-12-18 18:33
很美的特效制作,欣赏学习了,问好焱鑫磊

{:4_176:}

焱鑫磊 发表于 2023-12-18 19:59

红影 发表于 2023-12-18 18:49
这个是黑黑的路径吧,焱鑫磊的制作很漂亮

{:4_181:}{:4_204:}

焱鑫磊 发表于 2023-12-18 20:00

红影 发表于 2023-12-18 18:50
图片移动漂亮,歌曲好听。欣赏焱鑫磊好帖

{:4_190:}

红影 发表于 2023-12-18 21:03

焱鑫磊 发表于 2023-12-18 19:59


问好焱鑫磊,晚上好{:4_187:}

红影 发表于 2023-12-18 21:03

焱鑫磊 发表于 2023-12-18 20:00


{:4_204:}

焱鑫磊 发表于 2023-12-19 08:35

地址

本帖最后由 焱鑫磊 于 2023-12-19 08:57 编辑 <br /><br />https://www.kumeiwp.com/sub/filestores/2023/12/19/ac7251ec2ae35dca6f5ba9f56a0eb5df.MP3

https://www.qqmc.com/up/kwlink.php?id=235528208&.mp3

辫子哥哥 发表于 2023-12-19 12:24

好看,欣赏{:4_187:}

焱鑫磊 发表于 2023-12-19 16:59

辫子哥哥 发表于 2023-12-19 12:24
好看,欣赏

{:4_204:}

世外桃源 发表于 2023-12-19 22:55

问好楼主,不好意思 今天分没有了,加不了分了

世外桃源 发表于 2023-12-19 22:56

发现这个播放器简洁,很漂亮的

世外桃源 发表于 2023-12-19 22:56

欣赏佳作,感谢分享

焱鑫磊 发表于 2023-12-19 23:52

世外桃源 发表于 2023-12-19 22:55
问好楼主,不好意思 今天分没有了,加不了分了

{:4_190:}

焱鑫磊 发表于 2023-12-19 23:52

世外桃源 发表于 2023-12-19 22:56
发现这个播放器简洁,很漂亮的

{:4_176:}

焱鑫磊 发表于 2023-12-19 23:53

世外桃源 发表于 2023-12-19 22:56
欣赏佳作,感谢分享

{:4_187:}
页: [1]
查看完整版本: 《人生没有回头路》田娥