亚伦影音工作室 发表于 2026-8-5 21:06

我的楼兰 (DJ版) - DJ.【移到+视频】

本帖最后由 亚伦影音工作室 于 2026-8-6 03:38 编辑 <br /><br /><style>
@import url("https://fonts.googleapis.com/css2?family=Liu+Jian+Mao+Cao&family=Long+Cang&family=Ma+Shan+Zheng&family=ZCOOL+KuaiLe&family=ZCOOL+QingKe+HuangYou&display=swap");

#papa {
        margin: 140px -300px;
        width: 1286px;
        height: 720px;
        background:#500 ;
        box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 8px #880000;
        position: relative;overflow: hidden;
        z-index: 12345;
}

#mydiv {
       inset: 0; /* 水平方向居中 */
      width: 1286px;
      height: 100%;
       position: absolute;background:#800000;
      z-index: 1; /* 这个不要缺 */

    }
    /* 容器元素伪元素 */
    #mydiv::before, #mydiv::after {
      position: absolute;
      content: '';
      inset: 0; /* 定位,等同于 top、right、bottom、left 都为 0 */
      /* 如果容器和图片尺寸不一致,下句分号前加空格再加 0 0 / 100% 100% */
      background: url(https://image.hnol.net/c/2026-08/05/20/20260805202407141-5769293.jpeg) no-repeat 0 0/100% 100%;

    }
    #mydiv::before {
      background-position: var(--begin1) 0; /* 背景位置(值将由JS生成)*/
    }
   
#mydiv::after {
      transform: scale(-1, 1); /* 水平方向倒转 */
      background-position: var(--begin2) 0; /* 背景位置(值将由JS生成)*/
      z-index: -1; /* 重要,避免 :after 覆盖其它元素 */
    }

#vid { position: absolute; width: 80%; height: 80%; top:20%;left:20%; object-fit: cover; pointer-events: none;opacity: 1;z-index: 2; transition: 0.1s all ease;filter:hue-rotate(0deg)contrast(120%)brightness(100%);-webkit-mask-image: radial-gradient(black 25% ,transparent 65%);}
#bfq{position: absolute;
width: 250px;
height: 250px;top:55%; left:5%;z-index: 4;transform:translate(0%,0%)scale(0.6);}
#cd{top:40px; left:0px;z-index: 5;
position: absolute;
width: 200px;
height: 200px;
border-radius: 50%;
background:url('https://pic.imgdb.cn/item/6430f89c0d2dde57770c848e.png')no-repeat center/cover;
animation: spin 10s infinite linear ;}
@keyframes spin {100% { transform: rotate(360deg); }
}

#mplayer {z-index: 6;
        position: absolute;
        left: 0;
        bottom: 0px;
        width: 250px;
        height: 250px;
opacity: 1;
        transition: 0.5s;
       
        place-items: center;
        --disp1: 0; --disp2: 1;
}
#mplayer::before , #mplayer::after{
        position: absolute;
        content: '';
cursor: pointer;
        transition: 0.5s;
}
#mplayer::before {
        width: 250px;
        height: 250px;opacity: 1;
        background:url(https://pic.imgdb.cn/item/65f5104b9f345e8d03c1d60f.png)no-repeat center/cover;
        opacity: var(--disp1);
}
#mplayer::after {
        width: 250px;
        height: 250px;opacity: 1;
        background:url(https://pic.imgdb.cn/item/65f5103d9f345e8d03c17eca.png)no-repeat center/cover;
        opacity: var(--disp2);
}

#tmsg {position: absolute;z-index: 2;
      font: normal 18px sans-serif;
      color: #ffffff;
         top:100%;
      left:24%;}
#prog {position: absolute; display: grid; place-items: center; width: 215px; height: 215px; right: 42px; bottom: 3px;border-radius: 50%;-webkit-mask: radial-gradient( transparent 68%, #000 68%, #000 0);cursor: pointer; z-index: 6;}
#fullscreen{border-radius: 4px;position: absolute;
color:#eee;background:#0000;box-shadow:0px 0px 0px 0px #fff;
padding: 4px 8px;z-index: 100;
font:400 32px/0px "STKaiti";color: #000;
border: none;
cursor: pointer; top: 5%;
      left: 2%;
}

</style>

<div id="papa">

<span id="fullscreen">全屏欣赏</span>
<div id="mydiv"></div>
<video id="vid"src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/47f983ee136cca5c00509791e8351c77_preview.mp4" muted autoplay loop></video>

<div id="bfq"><div id="tmsg">00:00 | 00:00</div>
<div id="cd" ></div>
<divid="prog"></div>
<div id="mplayer"></div>
</div>
<div data-lrc="亚伦影音工作室" id="lrc">亚伦影音工作室</div>
</div>

<audio id="aud" src="https://s2.ananas.chaoxing.com/sv-w7/audio/d9/bd/aa/9af2708608affb8724fc348a58910944/audio.mp3" loop autoplay></audio>


<style type="text/css">
#lrc {
        --state: paused;
        --motion: cover2;
        --tt: 2s;
        --bg: linear-gradient(180deg, #880000, #880000);
        position: absolute;z-index: 4;
        left: 50%;
        transform: translate(-50%);
        top: 84%;
        font-weight:100;font-size:3.4em;font-family:"Ma Shan Zheng","STKaiti","SimHei",   cursive, serif;
        color: #000078;
        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 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
</style>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `我的楼兰 (DJ版) - DJ.
作曲 : DJ
编曲 : 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); /*获得歌词数组*/
})();
(function(){let mState = () => aud.paused ? (mplayer.style.setProperty('--disp1','1'), mplayer.style.setProperty('--disp2','0'),vid.pause(),cd.style.animationPlayState = 'paused') : (mplayer.style.setProperty('--disp1','0'), mplayer.style.setProperty('--disp2','1'),vid.play(),cd.style.animationPlayState = 'running');
mplayer.onclick = () => aud.paused ? (aud.play(),bgMove(mydiv, 0.6)) :(aud.pause(),cancelAnimationFrame(raf)) ;

aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
})();


// stop :动画开关;begin1 :移动背景初始值;raf :请求关键帧动画标识
    let stop = false, begin1 = 0, raf = null;
   
    // 移动背景函数 :elm - 容器元素,speed - 移动速度(缺省默认 0.5)
    function bgMove(elm, speed = 0.5) {
      const ww = elm.offsetWidth; // 取容器宽度
      // 内嵌移动函数
      function moving() {
            cancelAnimationFrame(raf); // 注销动画标识(防止速度变快)
            begin1 += speed; // ::before 伪元素移动值按速度递增
      if (speed > 0 && begin1 >= ww) begin1 = -ww; // 自左向右移动衔接算法
            if(speed < 0 && begin1 <= -ww) begin1 = ww; // 自右向左移动衔接算法
            // ::after 伪元素移动值算法 :依据 begin1 当前值动态计算
            const begin2 = begin1 >= 0 ? -1 * (begin1 - ww + 1) : -1 * (begin1 + ww - 1);
            // 处理伪元素所需 CSS 变量值
            elm.style.setProperty('--begin1', begin1 + 'px');
            elm.style.setProperty('--begin2', begin2 + 'px');
            
         
               
            // 依据外部 stop 变量注销或递归运行动画
            stop?cancelAnimationFrame(raf) : raf = requestAnimationFrame(moving);
      }
         
      moving();
    }
    bgMove(mydiv, 1); // 运行


let fs = true;
      fullscreen.onclick = () => {
                fs ? (fullscreen.innerText = '退出全屏', papa.requestFullscreen()) : (fullscreen.innerText = '全屏欣赏', document.exitFullscreen());
                fs = !fs;
      };

</script>


<script>
/*进度条 进度时间*/

prog.onclick = (e) => { let deg = Math.atan2(e.offsetY - 50, e.offsetX - 50) * 180 / Math.PI;
                deg += (e.offsetX < 50 && e.offsetY < 50) ?450 : 90;
                aud.currentTime = aud.duration * deg / 360;
                }
aud.addEventListener('timeupdate', () => {
               aud.addEventListener('timeupdate', () => {prog.style.background = 'conic-gradient(from -2deg, red, red, red ' + aud.currentTime / aud.duration * 100 + '%, #fff 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;
      };
/*结束*/
</script>

玫瑰 发表于 2026-8-5 21:09

沙发{:4_174:}精彩的分享。

杨帆 发表于 2026-8-5 23:55

漂亮别致,谢谢亚伦老师精彩示范{:4_190:}
页: [1]
查看完整版本: 我的楼兰 (DJ版) - DJ.【移到+视频】