亚伦影音工作室 发表于 2023-8-18 10:21

走心入梦的人(吉特巴版)-王馨

本帖最后由 亚伦影音工作室 于 2023-8-18 18:26 编辑 <br /><br /><style>
#papa { margin: 10px -300px ;width: 1164px;box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 6px #880000; overflow: hidden;height: 680px;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/64dea244661c6c8e54d9e683.gif" width="100%" height="100%"></div>
<div id="testImg" >
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/scene/preview_img_raw/ebef7d8cfd1a26f53bda4b294ac84e5d_preview_raw.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/42014cb258802bb1fe7bc96506aedee3.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/0b52f0a14a42b5a27908b8fd529751aa.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/dba0cb38039a6f2af2f0c043e5280498.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/0e9f44edbd2902404627111bac79f316.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/e280633e8ff81bfa215065607cd24ed1.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/0bbf4ce9f0fa09fd77d979e4f4e339c1.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/64958dad1ddac507cc005f0d.jpg" />

<img alt="" class="photo" src="https://pic.imgdb.cn/item/6141798a2ab3f51d91aa6423.jpg" />

<img alt="" class="photo"src="https://pic.imgdb.cn/item/642e2c05a682492fcc609190.jpg" />

<img alt=""class="photo"src="https://pic.imgdb.cn/item/6440cc3c0d2dde57773efc00.jpg" />

<img alt="" class="photo" src="https://pic.imgdb.cn/item/6444d4d20d2dde57777d1027.jpg" />

<img alt="" class="photo" src="https://pic.imgdb.cn/item/644c4c270d2dde5777f1b17f.jpg" />

<img alt="" class="photo" src="https://pic.imgdb.cn/item/645088790d2dde577794490d.jpg" />

<img alt="" class="photo" src="https://pic.imgdb.cn/item/645662e30d2dde577730c209.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://www.qqmc.com/mp3/music292388646.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 = `
走心入梦的人(吉特巴版)-王馨
作词:金艾娜
作曲:钰柃
编曲:DJ 默涵
出品发行:亚伦影音工作室
【未经著作权人许可不得翻唱翻录或使用】
如果没有一往情深
怎会懂得缘分捉弄人
我把你的情当了真
只想与你牵手在红尘
一颗心早为你失了魂
也曾为你把爱封存
看到你含情的眼神
好想给你一个拥吻
走了心入了梦的人
原来爱得如此认真
明知道相思扰乱心神
偏偏坠入相思门
走了心入了梦的人
可知我愿为你倾心
我相信爱能感天动地
缘分注定我们的今生
如果没有一往情深
怎会懂得缘分捉弄人
我把你的情当了真
只想与你牵手在红尘
一颗心早为你失了魂
也曾为你把爱封存
看到你含情的眼神
好想给你一个拥吻
走了心入了梦的人
原来爱得如此认真
明知道相思扰乱心神
偏偏坠入相思门
走了心入了梦的人
可知我愿为你倾心
我相信爱能感天动地
缘分注定我们的今生
如果没有一往情深
怎会懂得缘分捉弄人
我把你的情当了真
只想与你牵手在红尘
一颗心早为你失了魂
也曾为你把爱封存
看到你含情的眼神
好想给你一个拥吻
走了心入了梦的人
原来爱得如此认真
明知道相思扰乱心神
偏偏坠入相思门
走了心入了梦的人
可知我愿为你倾心
我相信爱能感天动地
缘分注定我们的今生
我相信爱能感天动地
缘分注定我们的今生`;

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

亚伦老师的这个帖子背景好像在《你是我的梦梦梦》里用过的吧,只是播放器不同{:4_173:}

红影 发表于 2023-8-18 10:47

哦,歌词同步的效果也和那个帖子不同。非常漂亮的制作。欣赏亚伦老师好帖{:4_199:}

醉美水芙蓉 发表于 2023-8-18 11:59

亚伦影音工作室 发表于 2023-8-18 12:44

红影 发表于 2023-8-18 10:45
亚伦老师的这个帖子背景好像在《你是我的梦梦梦》里用过的吧,只是播放器不同

不想再找图片了,重点强调播放器按钮和歌词特性!接连发了三个音画节奏好听!还有几个将陆续发表!

红影 发表于 2023-8-18 15:23

亚伦影音工作室 发表于 2023-8-18 12:44
不想再找图片了,重点强调播放器按钮和歌词特性!接连发了三个音画节奏好听!还有几个将陆续发表!

的确这个里面的播放器及歌词同步效果是不同的{:4_204:}
页: [1]
查看完整版本: 走心入梦的人(吉特巴版)-王馨