亚伦影音工作室 发表于 2024-6-12 16:28

孙露-寂寞沙洲冷(DJ伯格版)可控

本帖最后由 亚伦影音工作室 于 2024-6-16 20:55 编辑 <br /><br /><style>
        #papa { margin: 20px 0 20px calc(50% - 681px); background:#000 url('https://pic.imgdb.cn/item/666909c4d9c307b7e9e71bad.jpg') no-repeat center/cover;width: 1200px; height: 700px;   box-shadow: 3px 3px 6px gray; overflow: hidden; z-index: 1; position: relative; display: grid; place-items: center; }
#mplayer {z-index: 8;
        position: absolute;
        left:90px;
        bottom: 20px;
        width: 40px;
        height: 40px;
opacity: 1;
        transition: .2s;
       
        place-items: center;
        --disp1: 0; --disp2: 1;
}
#mplayer::before , #mplayer::after{
        position: absolute;
        content: '';
cursor: pointer;
        transition: .2s;
}
#mplayer::before {
        width: 40px;
        height: 40px;opacity: 1;
        background: url("https://pic.imgdb.cn/item/666469465e6d1bfa05bd07ea.png") no-repeat center/cover;
        opacity: var(--disp1);
}
#mplayer::after {
        width: 40px;
        height: 40px;opacity: 1;
        background: url("https://pic.imgdb.cn/item/6664693a5e6d1bfa05bcf7d3.png")no-repeat center/cover;
        opacity: var(--disp2);
}

#tmsg {position: absolute;z-index: 8;
      font: normal 12px sans-serif;
      color: #ffffff;
         bottom: 30px;
      left:87%;}
#prog {position: absolute;z-index: 8;
      width: 70%;
      height: 1.5px;
      cursor: pointer;
         bottom: 35px;
left:16%;
border-radius: 1px;}

#bt_prev{position: absolute;z-index: 8;
      width:30px;
      height: 30px;
bottom: 24px;left:40px;
      background: url("https://pic.imgdb.cn/item/6664695c5e6d1bfa05bd23cb.png")no-repeat center/cover;}
#bt_pnev{position: absolute;z-index: 8;
      width:30px;
      height: 30px;
bottom: 24px;left:150px;
      background: url("https://pic.imgdb.cn/item/66651ae45e6d1bfa0552bf2a.png")no-repeat center/cover;}
#lb{ position: absolute; bottom: 30px;right:52px; width: 22px; height: 20px;z-index: 8; }
#lb img{ width: 100%; height: 100%;}

</style>

<div id="papa">
<div id="testImg" >
<div class="book-wrap" >
<div class=" page " >&nbsp;</div>

<div class="page book-content book-content1">&nbsp;</div>

<div class="page book-content book-content2" >&nbsp;</div>

<div class="page book-content book-content3">&nbsp;</div>

<div class="page book-content book-content4">&nbsp;</div>

<div class="page book-content book-content5" >&nbsp;</div>

<div class="page book-content book-content6">&nbsp;</div>

<div class="page book-content book-content7">&nbsp;</div>

<div class="page book-content book-content8" >&nbsp;</div>

<div class="page book-content book-content9">&nbsp;</div>
</div>
</div>
<div id="tmsg">00:00 | 00:00</div><divid="prog"title="播放进度条"></div><div id="bt_prev"title="无效"></div><div id="bt_pnev"title="无效"></div>
<div id="lb" title="喇叭"> <img id="lbImg" src="https://pic.imgdb.cn/item/662615500ea9cb14035d435e.gif" alt="" /></div>
<div id="mplayer"title="暂停/播放"></div>
<div data-lrc="亚伦影音工作室" id="lrc">亚伦影音工作室</div>
</div>
<audio id="aud" src="https://s1.ananas.chaoxing.com/sv-w9/audio/b0/5d/95/290eeb11200a31f7fbcdfdf5be4ec816/audio.mp3" loop autoplay></audio>


<style type="text/css">
#lrc {
        --state: paused;
        --motion: cover2;
        --tt: 2s;
        --bg: #000;
        position: absolute;z-index: 4;
        left: 50%;
        transform: translate(-50% );
        top: 80%;
        font:normal 3em 华文隶书;
        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%;top: -80%;
        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 { from { width: 100%;transform:rotateY(180deg); } to { width: 100%;} }
@keyframes cover2{ from { width: 100%; transform: rotateY(180deg); } to { width: 100%;} }
</style>
<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); /*获得歌词数组*/
})();

</script>
<script>
let mState = () => aud.paused ? (mplayer.style.setProperty('--disp1','1'), mplayer.style.setProperty('--disp2','0')) : (mplayer.style.setProperty('--disp1','0'), mplayer.style.setProperty('--disp2','1'));
mplayer.onclick =function() { aud.paused ?(aud.play(),imagelb.play()): ( aud.pause(),imagelb.stop())};
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
var imagelb= document.getElementById("lbImg");

/*进度条 进度时间*/
prog.onclick = (e) => {
                aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
      }
aud.addEventListener('timeupdate', () => {
               aud.addEventListener('timeupdate', () => {prog.style.background= 'linear-gradient(90deg, #ff0000, #ff0000, #ff0000 '+ aud.currentTime / aud.duration * 100 + '%, #eeeeee 0)';});
                tmsg.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);

      });
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;
      };
/*结束*/
(function(){
var image = document.getElementById("testImg");
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;
            // 透明度还原
            imagelb.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;
            }
      }
    };
}

</script>
<style type="text/css">
.book-wrap {width: 480px;
            height: 350px;
            position: relative;
            left: 340px;
            top: 50px;
            transform: rotatez(4deg)rotateX(20deg)scale(.6);
            transform-style: preserve-3d;}
.page { width: 100%;
      height: 100%;
      position: absolute;
background: url(https://s10.krakenfiles.com/uploads/12-06-2024/BqnqHKCP9q/image.gif)no-repeat center/cover;
      border-radius: 2px;border: 15px solid #F5F3D1;
      transform-origin: left;display: flex;
    justify-content: center;
   align-items: center;
    box-shadow:0px 0px 0px 2px #000000;
    }
.book-contenr {animation: roll 22s0s   infinite;background: url(https://s8.krakenfiles.com/uploads/12-06-2024/4K187bfyQN/image.gif)no-repeat center/cover}
.book-content1{animation: roll4s 18s2;background: url(https://s8.krakenfiles.com/uploads/12-06-2024/zvoxQIkT1m/image.gif)no-repeat center/cover}
.book-content2{animation: roll6s 16sinfinite;background: url(https://s8.krakenfiles.com/uploads/12-06-2024/GCZAIcnUY0/image.gif)no-repeat center/cover}
.book-content3{animation: roll8s 14s4;background: url(https://s8.krakenfiles.com/uploads/12-06-2024/6nN8W00rqi/image.gif)no-repeat center/cover}
.book-content4{animation: roll 10s 12s2;background: url(https://s10.krakenfiles.com/uploads/12-06-2024/dQtfF9oiAs/image.gif)no-repeat center/cover}
.book-content5{animation: roll 12s 10sinfinite;background: url(https://s10.krakenfiles.com/uploads/12-06-2024/lq9KPP5FdL/image.gif)no-repeat center/cover}
.book-content6{animation: roll 14s8s6;background: url(https://s10.krakenfiles.com/uploads/12-06-2024/XZETmzvXGm/image.gif)no-repeat center/cover}
.book-content7{animation: roll 16s6s3;background: url(https://s10.krakenfiles.com/uploads/12-06-2024/6GjkDKVfgA/image.gif)no-repeat center/cover}
.book-content8{animation: roll 18s4s2;background: url(https://s9.krakenfiles.com/uploads/12-06-2024/T3SgJZb2yf/image.gif)no-repeat center/cover}
.book-content9{animation: roll 20s2s   infinite;background: url(https://s8.krakenfiles.com/uploads/12-06-2024/czFQyDHYQN/image.gif)no-repeat center/cover}
.stop .book-contenr,
.stop .book-content1,
.stop .book-content2,
.stop .book-content3,
.stop .book-content4,
.stop .book-content5,
.stop .book-content6,
.stop .book-content7,
.stop .book-content8,
.stop .book-content9{animation-play-state: paused;}
@keyframes roll {
0% {transform: rotateY(0deg);opacity: 1;}
30% {transform: rotateY(-170deg);opacity: 1;}
40% {transform: rotateY(-178deg);opacity: 1;}
50% {transform: rotateY(-180deg);opacity: 1;}
100% {transform: rotateY(-180deg);opacity: 1;}
}
</style>

老谟深虑 发表于 2024-6-12 16:32

          好制作,好代码,学习了。

红影 发表于 2024-6-12 19:02

漂亮的翻页效果。欣赏亚伦老师好帖{:4_199:}

梦油 发表于 2024-6-12 21:12

欣赏佳作,问候亚伦。

樵歌 发表于 2024-6-13 07:32

那个大美女和南无月那个貌似模样相同。

亚伦影音工作室 发表于 2024-6-13 09:07

樵歌 发表于 2024-6-13 07:32
那个大美女和南无月那个貌似模样相同。

就是人家的图!

小辣椒 发表于 2024-6-13 17:57

发现喜欢这个翻页效果的人还不少,前几天也是看见有人玩了{:4_173:}

小辣椒 发表于 2024-6-13 17:58

亚伦设置了一键停止{:4_199:}

小辣椒 发表于 2024-6-13 17:58

欣赏亚伦精彩的制作
页: [1]
查看完整版本: 孙露-寂寞沙洲冷(DJ伯格版)可控