《愿我们运气越来越好》 - 红蔷薇 (试帖亚伦老师代码)
本帖最后由 亦是金 于 2024-1-30 16:25 编辑 <br /><br /><style>#papa {
margin: 50px 0 0 calc(50% - 681px);
width: 1200px;
height: 700px;
border: 6px solid rgba(36, 201, 219,.95);
border-radius: 20px;
background: url('https://s4.ax1x.com/2022/02/19/HbLFmQ.jpg') no- repeat center/cover;
box-shadow: 3px 3px 20px #000;
position: relative;
z-index: 1;
display: grid;
place-items: center;
overflow: hidden;
}
#prog {
position: absolute;
bottom: 20px;
width: 280px;
height: 5px;
background: linear-gradient(to right, #575efb, #fa47fc var(--prg), white 0);
color: snow;
display: grid;
place-items: center;
--prg: 0%;
--state: paused;
border-radius: 2px;
}
#prog::before, #prog::after { position: absolute; color: #ffffff; font:normal 1em 华文新魏;}
#prog::before { content: attr(data-cu); left:-50px; top: -5px; }
#prog::after { right: -50px; content: attr(data-du); ; top: -5px; }
#slider {
position: absolute;
width: 6px;
height: 6px;
background: #cccccc;
box-shadow: 0px 0px 0px 3px #fa47fc;
left: var(--prg);
border-radius: 50%;
}
#btnplay {
position: absolute;
top: -95px;
width: 90px;
height: 90px;
background: url('https://ysj147.s3-us-east-1.ossfiles.com/zzsc/png/image.png') no-repeat center/cover;
cursor: pointer;
animation: rot 6s infinite linear var(--state);
}
@keyframes rot { to { transform: rotate(-1turn); filter: hue-rotate(360deg);} }
.ipic { position: absolute; bottom: 0;transform: skew(-3deg);transform-origin: 0% 0%;}
.ipic:nth-of-type(1) { left: 20px; top: 0px;animation: skew1 3sinfinite linear;width: 300px; height: 220px;}
.ipic:nth-of-type(2) { left: 850px; top: 0px; animation: skew2 6sinfinite linear; width: 200px; height: 220px; }
.ipic:nth-of-type(3) { left: 1020px; top: -70px;animation: skew3 3sinfinite linear;width: 205px; height: 270px;}
.stop .ipic:nth-of-type(1){animation-play-state: paused;}
.stop .ipic:nth-of-type(2){animation-play-state: paused;}
.stop .ipic:nth-of-type(3){animation-play-state: paused;}
@keyframes skew1 { 50%{ transform: skew(3deg); } }
@keyframes skew2 { 50%{ transform: skew(3deg); } }
@keyframes skew3 { 50%{ transform: skew(3deg); } }
.xipic { position: absolute; bottom: 0;transform: skew(-3deg);transform-origin: bottom center;}
.xipic:nth-of-type(4) { left: 20px; bottom: -20px; animation: skew1 3sinfinite linear;width: 150px; height: 320px;}
.xipic:nth-of-type(5) { left: 990px; animation: skew2 6sinfinite linear; width: 200px; height: 350px; }
.xipic:nth-of-type(6) { left: 860px; bottom: -20px; animation: skew3 4sinfinite linear;width: 155px; height: 220px;}
.stop .xipic:nth-of-type(4){animation-play-state: paused;}
.stop .xipic:nth-of-type(5){animation-play-state: paused;}
.stop .xipic:nth-of-type(6){animation-play-state: paused;}
@keyframes skew4 { 50%{ transform: skew(3deg); } }
@keyframes skew5 { 50%{ transform: skew(3deg); } }
@keyframes skew6 { 50%{ transform: skew(3deg); } }
#vid { position: absolute; width: 100%; height: 110%; top:-10%; object-fit: cover; pointer-events: none;opacity: 1;z-index: -1; transition: 0.1s all ease;}
#papa::before {
position: absolute;
content: '';
width: 100%;
height: 100%;
background: url('https://s4.ax1x.com/2022/02/19/HbLFmQ.jpg') no-repeat center/cover;
clip-path: polygon(var(--x0) 0, 100% var(--x0), calc(100% - var(--x0)) 100%, 0 calc(100% - var(--x0)));
transition: all 1.65s;
}
#papa:hover::before { opacity: .8; transform: scale(.0); }
#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: 530px;
font:normal 3em 华文新魏;
font-weight:400;
color: #000080;
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: 0%;}100% { width: 100%;filter: hue-rotate(360deg);}}
@keyframes cover2 { 0% { width: 0%;}100% { width: 100%;filter: hue-rotate(360deg);}}
</style>
<div id="papa">
<video id="vid"src="https://img.tukuppt.com/video_show/2475824/00/02/16/5b53ecf990256_10s_big.mp4" muted autoplay loop></video>
<div id="testImg">
<img class="ipic" src="https://pic.imgdb.cn/item/65b7b60a871b83018add7e03.png" alt="" />
<img class="ipic" src="https://pic.imgdb.cn/item/65b76370871b83018a9bd85f.png" alt="" />
<img class="ipic" src="https://z4a.net/images/2024/01/30/65353397_16.png" alt="" />
<img class="xipic" src="https://z4a.net/images/2024/01/30/102486244_41.png" alt="" />
<img class="xipic" src="https://z4a.net/images/2024/01/30/52279182_20.png" alt="" />
<img class="xipic" src="https://pic.imgdb.cn/item/65b76fca871b83018ac1d6b5.png" alt="" />
</div>
<div id="prog" data-cu="00:00" data-du="00:00" title="调节进度">
<span id="btnplay" title="播放/暂停"></span>
<span id="slider"></span>
</div>
<div data-lrc="亚伦影音工作室" id="lrc" title="歌词显示">亚伦影音工作室</div>
</div>
<audio autoplay="" id="aud" loop="" src="https://www.qqmc.com/mp3/music331365520.mp3"> </audio>
<script>
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 = () => 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(),vid.play() ):( aud.pause(),vid.pause()); }
prog.onclick = (e) => aud.currentTime = e.offsetX * aud.duration / prog.offsetWidth;
vid=document.querySelector('#vid');
(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 >
(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'),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>
<div style="position: relative; top: -700px; LEFT: -280px;z-index: 12435;">
<style type="text/css">
@keyframes mv { from { background-position: 1200px 0; } to { background-position: 0 0; } }
body { overflow-x: hidden; }
#baiBox {
margin: auto;
width: 800px;
text-align: center;
font-family:微软简中圆;
font-size: 2.5rem;
font-weight: bold;
color: #f46ff6;
transform-origin: top;
animation: yao 1.0s linear infinite alternate;
}
@keyframes yao {
from{transform: perspective(800px) rotatex(30deg); }
to { transform: perspective(800px) rotatex(-30deg); }
}
.tit { position: absolute; width: 500px;height: 50px;top: 10px;LEFT: 300px;z-index: 100;filter: drop-shadow(-1px 1px 1px #ffffff)drop-shadow(0px -1px 1px #ffffff)drop-shadow(0px 0px 1px #ffffff)drop-shadow(0px 0px 1px #ffffff)drop-shadow(0px 0px 1px #ffffff) }
#tit:hover { color: green; }
/*标题位置 移动范围设置*/
</style>
<div id="hu" >
<div id="baiBox"
<div class="tit">
<span style="color:#fb52f9;"><span style="font-size:28px;">《愿我们运气越来越好》 </span>
<span style="color:#3d46f7;"><span style="font-size:22px;">- 红蔷薇</span></div>
<div style="position: relative;width: 500px;height: 50px;top: 650px;LEFT: 1100px;z-index: 100;filter: drop-shadow(-1px 1px 1px #e8f552)drop-shadow(0px -1px 1px #e8f552)drop-shadow(0px 0px 1px #e8f552)drop-shadow(0px 0px 1px #e8f552)drop-shadow(0px 0px 1px #e8f552)">
<p><span style="color:#ff0000;"><span style="font-family:华文隶书;"><span style="font-size:22px;">亦是金在线音乐</span></span></span></p></div>
{:5_150:}{:5_150:}{:5_150:} 背景会变换的{:5_150:} 愿我们大家运气越来越好{:5_124:} liumang 发表于 2024-2-2 10:27
问好管理!{:5_116:} liumang 发表于 2024-2-2 10:28
背景会变换的
谢谢欣赏{:5_127:} liumang 发表于 2024-2-2 10:29
愿我们大家运气越来越好
祝愿我们大家运气越来越好!{:5_128:} 试贴。。。。。?
不是正式贴吗?
页:
[1]