《片片枫叶情》 (粤语)(试帖亚伦,好难老师代码)
<div style="width: 1024px;height: 576px;box-shadow:0px 0px 0px 0px #045768, 0px 0px 0px 4px #99e5f5,0px 0px 0px 0px #045768;overflow:hidden;border-radius:2%;margin-top:130px;margin-LEFT: -20px;"><style>
#papa {
margin: auto;
width: 1024px;
height: 576px;
overflow: hidden;
display: grid;
place-items: center;
box-shadow: 0px 0px 0px gray;
position: relative;
z-index: 1;
--state: paused;
}
#outframe{ width: 1024px; height: 576px; position: absolute;
z-index: 1;background: #000000 url(https://z4a.net/images/2023/12/03/HOqLUH.jpg)no-repeat center/cover;
top: 0px; left: 0px;
animation: rod 4s linear infinite;}
#outframe{
width:1024px;height:576px;position: relative;background: #000000; box-shadow: 0 0 8px #000;margin: 0px auto 0px 0px;
overflow:hidden;border-radius:20px;background:no-repeat cover/center;background-color:skyblue;
}
@keyframes rod{
0% {opacity: 0.9;filter:hue-rotate(360deg)}
30% {opacity: 1.2;}
60% {opacity: 0.9;}
100% {opacity: 1.1;}
}
#player {
width: 80px;
height: 80px;
left: 80px;
top: 400px;
cursor: pointer;
background: url('https://ysj147.s3-us-east-1.ossfiles.com/zzsc/png/四叶草02g.png') no-repeat center/cover;
filter: hue-rotate(0deg) opacity(.9);
animation: rotating 6s linear infinite var(--state);
position: absolute;
z-index: 81;
}
li-zi { position: absolute;width: 45px; height: 45px;background: tan;
clip-path: polygon(49% 68%, 51% 100%, 48% 100%, 44% 75%, 35% 84%, 24% 90%, 24% 76%, 33% 65%, 17% 70%, 6% 67%, 14% 56%, 27% 52%, 14% 38%, 13% 19%, 32% 25%, 41% 39%, 48% 23%, 59% 16%, 65% 30%, 61% 45%, 73% 38%, 85% 39%, 92% 42%, 84% 53%, 75% 59%, 61% 61%, 72% 68%, 77% 81%, 77% 87%, 62% 83%, 54% 77%); animation: imov 22s infinite;z-index: 2;}
@keyframes moving {
100%{ opacity: 1; transform: translate(var(--x0),var(--y0)) rotate(var(--deg)); filter:hue-rotate(360deg);}
0%{ opacity: 0; transform: translate(0,0) rotate(var(--deg)); }
}
@keyframes rotating { to { transform: rotate(360deg); } }
#lrc {
--state: paused;
--motion: cover2;
--tt: 2s;
--bg: linear-gradient(0deg, #ff0000, #ff0000, #ff0000);
position: absolute;z-index: 6;
left: 25%;
transform: translate(-50%);
top: 500px;
font:normal 2.0em 微软简中圆;
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%;}}
@keyframes cover2 { 0% { width: 0%;}100% { width: 100%;}}
</style>
<div style="position: relative; top:-90px;LEFT: 0px;z-index: 12435;">
<style type="text/css">
@keyframes mv { from { background-position: 1200px 0; } to { background-position: 0 0; } }
body { overflow-x: hidden; }
#baiBox {
font-size: 26px;
color: #ff0000;
position: relative;
text-align:center;
transform: translate(0%,35%);
font-weight: normal;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-image: linear-gradient(45deg, #F32121 32%,#8EE73C 43%,#FEFFFF 52%,#091CFD 62%,#36F4B1 75%);
background-position: -1200px 0;
filter:drop-shadow(#000000 1px 0 0)drop-shadow(#000000 0 1px 0)drop-shadow(#000000 -1px 0 0) drop-shadow(#000000 0 -1px0);
-webkit-animation:loop 3s linear 1000000;
}
@-webkit-keyframes loop{
0%{background-position: -1200px 0;}
100%{background-position: -0 0;}
}
.tit {
position: relative;
width: 700px;
top: 100px;
left: -60px;;
font-family:迷你简细圆;
font-size: 40px;
text-shadow: 2px 2px #ff00ff;
font-weight:bold;
color:#802A2A;z-index: 10; }
#tit:hover { color: green; }
/*标题位置 移动范围设置*/
</style>
<div id="hu" >
<div id="baiBox"
<div class="tit">
<span>《片片枫叶情》(粤语) - 许秋怡 / 张智霖</span>
<span > </span></div>
<div style="position: relative;width: 500px;height: 50px;top:570px;LEFT: 840px;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>
</style>
<div id="papa">
<div id="outframe">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1" viewBox="0 0 720 420">
<image xlink:href="https://z4a.net/images/2023/12/23/fengye01.jpg" width="720" height="420" x="0" y="0" opacity='0'preserveAspectRatio="none" >
<animate id="bp0" attributename="opacity" from='0' to='1' begin="0; ep4.end-6" dur='4s' fill="freeze"/>
<animate id="ep0" attributename="opacity" from=1' to='0' begin="bp0.begin+18" dur='3s' fill="freeze"/>
</image>
<image xlink:href="https://z4a.net/images/2023/12/23/fengye02.jpg" width="720" height="420" x="0" y="0" opacity='0'preserveAspectRatio="none" >
<animate id="bp1" attributename="opacity" from='0' to='1' begin="ep0.end-6" dur='4s' fill="freeze"/>
<animate id="ep1" attributename="opacity" from=1' to='0' begin="bp1.begin+18" dur='3s' fill="freeze"/>
</image>
<image xlink:href="https://z4a.net/images/2023/12/23/fengye03.jpg" width="720" height="420" x="0" y="0" opacity='0'preserveAspectRatio="none" >
<animate id="bp2" attributename="opacity" from='0' to='1' begin="ep1.end-6" dur='4s' fill="freeze"/>
<animate id="ep2" attributename="opacity" from=1' to='0' begin="bp2.begin+18" dur='3s' fill="freeze"/>
</image>
<image xlink:href="https://z4a.net/images/2023/12/23/fengye04.jpg" width="720" height="420" x="0" y="0" opacity='0'preserveAspectRatio="none" >
<animate id="bp3" attributename="opacity" from='0' to='1' begin="ep2.end-6" dur='4s' fill="freeze"/>
<animate id="ep3" attributename="opacity" from=1' to='0' begin="bp3.begin+18" dur='3s' fill="freeze"/>
</image>
<image xlink:href="https://z4a.net/images/2023/12/23/fengye05.jpg" width="720" height="420" x="0" y="0" opacity='0'preserveAspectRatio="none" >
<animate id="bp4" attributename="opacity" from='0' to='1' begin="ep3.end-6" dur='4s' fill="freeze"/>
<animate id="ep4" attributename="opacity" from=1' to='0' begin="bp4.begin+18" dur='3s' fill="freeze"/>
</image>
</svg>
</div>
<svg width="10244" height="576">
<filter id="spot">
<feDiffuseLighting in="SourceGraphic" surfaceScale="3" diffuseConstant="5" lighting-color="#fea1ee" id="feDiff">
<feSpotLight x="0" y="0" z="5" pointsAtX="120" pointsAtY="150" pointsAtZ="0" limitingConeAngle="55">
</feSpotLight>
</feDiffuseLighting>
</filter>
<rect x="0" y="0" width="1024" height="576" filter="url(#spot)"></rect>
</svg>
<div id="player" title="播放/暂停"></div>
<div data-lrc="" id="lrc" title="歌词显示"></div>
<audio id="aud" src="http://music.163.com/song/media/outer/url?id=314044.mp3" autoplay loop></audio>
</div>
<script>
(function() {
let all = 40;
for(let i = 0; i < all; i++) {
let movBall = document.createElement('li-zi');
let hudu = Math.PI / 180 * 360 / all * i;
let xx = 600 * Math.cos(hudu), yy = 600 * Math.sin(hudu);
movBall.style.cssText += `
--x0: ${xx}px;
--y0: ${yy}px;
--deg: ${360 / all * i}deg;
background: #${Math.random().toString(10).substr(-6)};
animation: moving ${Math.random() * 5 + 5}s -${Math.random() * 2}s infinite var(--state);
`;
papa.prepend(movBall);
}
let playMusic = () => aud.paused ? (aud.play(), player.title='暂停') : (aud.pause(), player.title='播放');
let mState = () => papa.style.setProperty('--state', aud.paused ? 'paused' : 'running');
aud.addEventListener('playing',mState,false);
aud.addEventListener('pause',mState,false);
player.addEventListener('click',playMusic,false);
})();
</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); /*获得歌词数组*/
})();
outframe.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>outframe.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>outframe.style.animationPlayState = 'paused');
</script> 问好亦是金老师,背景是变色特效,歌曲好听{:5_150:} 感谢分享{:5_150:}{:5_150:}{:5_150:} 欣赏前辈精彩的制作,亚伦的代码啊,非常漂亮哦{:5_150:} liumang 发表于 2023-12-26 21:16
问好亦是金老师,背景是变色特效,歌曲好听
问好管理!谢谢欣赏点赞!{:5_116:} liumang 发表于 2023-12-26 21:17
感谢分享
祝你欣赏愉快!{:5_116:} 小辣椒 发表于 2023-12-26 22:36
欣赏前辈精彩的制作,亚伦的代码啊,非常漂亮哦
谢谢欣赏点赞!{:5_116:} 试贴。。。。。?
不是正式贴吗?
页:
[1]