亚伦影音工作室 发表于 2023-10-7 07:29

‘照抄,克隆,抄袭’还挺自豪的!

<style>
#papa {margin: 0px 0 0 calc(50% - 681px); width: 1164px;height:680px;box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 6px #880000; overflow: hidden;place-items: center; position: relative;z-index: 12345;background: #333;}
#vid { position: absolute; width: 100%; height: 100%; top:0%; object-fit: cover; pointer-events: none; z-index: -1; opacity: 1; transition: 0.1s all ease;}
#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); }

#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>
<video id="vid"src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/0febdc4d9660edc6b4576c1c1dbc620c_preview.mp4" muted autoplay></video>
<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="#1E90FF" />
      <g transform="translate(30,110)" fill="#1E90FF">
                <text id="cu" x="0" y="0">00:00</text>
                <image id="btnPlay" x="45" y="-22" width="30" height="30" xlink:href="https://638183.freep.cn/638183/t23/btn/pause2.png"></image>
                <text id="du" x="90" y="0">00:00</text>
      </g>
</svg>
<audio id="aud" src="https://www.qqmc.com/mp3/music304301952.mp3" autoplay loop></audio>
<div id="lrc" data-lrc="HCPlayer">HCPlayer</div>

</div>

<script>
let posAr = [];
let len = sPath.getTotalLength();
let playImg = 'https://638183.freep.cn/638183/t23/btn/play2.png',
      pauseImg = 'https://638183.freep.cn/638183/t23/btn/pause2.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();

(function() {let vid = document.querySelector('vid');
let mState = () => aud.paused ?vid.pause() :vid.play();
aud.addEventListener('pause', mState, false);
aud.addEventListener('play', mState, false);})();
setInterval( () => { aud.paused ? vid.pause() : vid.play(); },100);
</script>
<script>
(function() {
/*原始lrc歌词*/
let lrcStr = `梦醒时分
作词:李宗盛
作曲:李宗盛
演唱:半吨兄弟
制作:亚伦影音工作室
你说你爱了不该爱的人
你的心中满是伤痕
你说你犯了不该犯的错
心中满是悔恨
你说你尝尽了生活的苦
找不到可以相信的人
你说你感到万分沮丧
甚至开始怀疑人生
早知道伤心总是难免的
你又何苦一往情深
因为爱情总是难舍难分
何必在意那一点点温存
要知道伤心总是难免的
在每一个梦醒时分
有些事情你现在不必问
有些人你永远不必等
你说你爱了不该爱的人
你的心中满是伤痕
你说你犯了不该犯的错
心中满是悔恨
你说你尝尽了生活的苦
找不到可以相信的人
你说你感到万分沮丧
甚至开始怀疑人生
早知道伤心总是难免的
你又何苦一往情深
因为爱情总是难舍难分
何必在意那一点点温存
要知道伤心总是难免的
在每一个梦醒时分
有些事情你现在不必问
有些人你永远不必等
早知道伤心总是难免的
你又何苦一往情深
因为爱情总是难舍难分
何必在意那一点点温存
要知道伤心总是难免的
在每一个梦醒时分
有些事情你现在不必问
有些人你永远不必等
`;

/*变量 :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>
var dts = ["https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/ff54d79ff2ebf815ef1b29d476374829_preview.mp4",
"https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/0febdc4d9660edc6b4576c1c1dbc620c_preview.mp4",
"https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/097d22b11081d458bc107813f27f7dc0_preview.mp4",
"https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/02e3f2bedd6f62d779c66bcea8e202c2_preview.mp4"
];
var dt= document.getElementById('vid');
var dtIdx = 1;
dt.onended = function()      {
      dt.src = dts;
      dtIdx++;
      dtIdx %= dts.length;
}
</script>

马黑黑 发表于 2023-10-7 07:51

{:4_199:}

红影 发表于 2023-10-7 09:08

这标题,看得笑{:4_173:}
学习的过程也包含模仿这一环节呢,自己选的视频和歌曲以及做的歌词,算不得照抄呢{:4_173:}

红影 发表于 2023-10-7 09:11

制作很漂亮。不过看到这标题都没法加精呢。
其实这句可以放在回帖里的{:4_173:}

红影 发表于 2023-10-7 09:12

欣赏亚伦老师好帖{:4_187:}

亚伦影音工作室 发表于 2023-10-7 10:10

红影 发表于 2023-10-7 09:08
这标题,看得笑
学习的过程也包含模仿这一环节呢,自己选的视频和歌曲以及做的歌词,算不得照抄 ...

低调谦虚嘛!{:4_198:}{:4_170:}

红影 发表于 2023-10-7 10:13

亚伦影音工作室 发表于 2023-10-7 10:10
低调谦虚嘛!

这个低调过头了点{:4_173:}

醉美水芙蓉 发表于 2023-10-7 11:45

老谟深虑 发表于 2023-10-7 13:20

       欣赏老师的精美制作,学习点赞!

小辣椒 发表于 2023-10-7 21:17

这个背景视频美女特别养眼,{:4_173:}

小辣椒 发表于 2023-10-7 21:17

其实这个路径播放器简洁,我很喜欢的,这个播放器我很喜欢的
页: [1]
查看完整版本: ‘照抄,克隆,抄袭’还挺自豪的!