醉美水芙蓉 发表于 2024-10-14 20:34:36

不装饰你的梦

<style>
#papa{
        position: relative;
        width: 1164px;
        height: 640px;
      margin-left:-150px;
        margin-top:160px;
        border: 0px solid rgba(36, 201, 219,.95);
      border-radius: 0px;
        background:#000 url(https://img-baofun.zhhainiao.com/pcwallpaper_ugc/live/3e5611dd3e583cb2da7e8ef3e825838d.mp4.jpg)no-repeat center/cover;
        overflow: hidden;
}
.img-container {
position: relative;
height: 700px;
width: 800px;
perspective: 500px;left:350px;
transform-style: preserve-3d;
}
.box {      
width: 620px;
height: 400px;
border-radius: 0px;
overflow: hidden;
border: 3px solid #ccc;
position: absolute;
top: 40%;
transition: 800ms ease-in-out;
}

.box img {
width: 100%;
height: 100%;
}

.box:first-of-type {
z-index: 1;
opacity: 0;
left: 15%;
transform: translate(-100%, -100%) rotateY(50deg);
}

.box:nth-of-type(2) {
opacity: 1;
left: 20%;
transform: translate(-50%, -50%) rotateY(-10deg);
z-index: 1;
}

.box:nth-of-type(3) {
left: 25%;
opacity: 0.90;
color: #eee;
z-index: 10;
transform: translate(-50%, -50%) rotateY(-10deg) translateZ(-40px);
}
.box:nth-of-type(4) {
z-index: 8;
opacity: 0.80;
left:30%;
transform: translate(-50%, -50%) rotateY(-10deg) translateZ(-80px);
}

.box:nth-of-type(5) {
z-index: 7;
opacity: 0.70;
left: 35%;
transform: translate(-50%, -50%) rotateY(-10deg) translateZ(-120px);
}

.box:nth-of-type(6) {
z-index: 6;
opacity: 0.6;
left: 40%;
transform: translate(-50%, -50%) rotateY(-10deg) translateZ(-160px);
}

.box:nth-of-type(7) {
z-index: 5;
opacity: 0.5;
left: 45%;
transform: translate(-50%, -50%) rotateY(-10deg) translateZ(-200px);
}
.box:nth-of-type(8) {
z-index: 4;
opacity: 0.4;
left: 50%;
transform: translate(-50%, -50%) rotateY(-10deg) translateZ(-240px);
}
.box:nth-of-type(9) {
z-index: 3;
opacity: 0.3;
left: 55%;
transform: translate(-50%, -50%) rotateY(-10deg) translateZ(-280px);
}
.box:nth-of-type(10) {
z-index: 2;
opacity: 0;
left: 60%;
transform: translate(-50%, -50%) rotateY(-10deg) translateZ(-320px);
}
#mplayer {position: absolute;
      bottom:20%; left:40px;z-index: 21;
      width: 200px;
      height: 200px;
      cursor: pointer;transition: 0.5s all ease;
}
.pink {transition: 0.1s all ease;background: url('https://pic.imgdb.cn/item/65f0d8299f345e8d03ff0b31.gif')no-repeat center/cover;}
.purple {transition: 0.1s all ease;background: url('https://pic.imgdb.cn/item/65f0d8669f345e8d03ff5c34.png')no-repeat center/cover;}

</style>
<div id="papa" >
<div class="img-container" >
      <div class="box">
      <img src="http://www.qslt.net/data/attachment/forum/202410/08/230517oucf37j7lqvu3dfy.jpg" alt="">
      </div>
      <div class="box">
         <img src="http://qslt.net/data/attachment/forum/202409/29/211646qah88hh0i9xggaai.jpg" alt="">
      </div>
      <div class="box">
      <img src="http://qslt.net/data/attachment/forum/202409/25/155246z6t5htz7kk05tj7a.jpg" alt="">
      </div>
      <div class="box">
         <img src="http://qslt.net/data/attachment/forum/202409/21/102901wfpasma7pg9asaas.jpg" alt="">
      </div>
      <div class="box">
         <img src="http://www.qslt.net/data/attachment/forum/202409/17/194050khrr1442jm2gp2jg.jpg" alt="">
      </div>
      <div class="box">
      <img src="http://qslt.net/data/attachment/forum/202408/29/114938ztkxxckgczg00pkl.jpg" alt="">
      </div>

<div class="box">
         <img src="http://qslt.net/data/attachment/forum/202408/27/164830b6uq0youor6z721n.jpg" alt="">
      </div>
<div class="box">
         <img src="http://qslt.net/data/attachment/forum/202408/21/173152n0onwggjwo5zo2nn.jpg" alt="">
      </div>
<div class="box">
         <img src="http://qslt.net/data/attachment/forum/202408/20/111314ko68onf8fbbxfn96.jpg" alt="">
      </div>
<div class="box">
         <img src="http://qslt.net/data/attachment/forum/202408/16/202604fq6kuk8b8gu3bzk2.jpg" alt="">
      </div>
</div>   
<div id="mplayer" class="pink" > </div>
<div data-lrc="醉美水芙蓉" id="lrc">醉美水芙蓉</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=67570" autoplay="" loop="loop"></audio>
</div>

<script>
let imgContainer = document.querySelector(".img-container");
setInterval(() => {
   if(!aud.paused){
      let last = imgContainer.firstElementChild;
      last.remove();
      imgContainer.appendChild(last);}
      }, 2500);

aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
mplayer.addEventListener('click', () => aud.paused ? (aud.play(),mplayer.classList.remove('purple')) :(aud.pause(),mplayer.classList.add('purple')));
</script>

<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: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%;
        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;transform: perspective(120px) rotateY(-90deg); } to { width: 100%;} }
@keyframes cover2{ from { width: 0; transform: perspective(120px) rotateY(90deg); } to { width: 100%;} }
</style>
<script >
(function() {
/*原始lrc歌词*/
let lrcStr = `不装饰你的梦 - 蔡国权 (Terence Tsoi)
词:郑国江
曲:蔡国权
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'),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>

yrzcvnd 发表于 2024-10-16 16:48:39

http://rjdq.huofh.club/data/attachment/forum/202410/16/164735e62mw2d0uufdu2er.jpg

确认过眼神 发表于 2024-10-28 17:21:29

这个作品漂亮!!!!

332 发表于 2024-11-3 17:51:30

这个作品漂亮!!!!

午老虎 发表于 2024-11-11 13:38:22

这个作品漂亮!!!!

蓝叶 发表于 2024-11-20 02:17:13

这个作品漂亮!!!!
页: [1]
查看完整版本: 不装饰你的梦