《片片枫叶情》 - 周虹/江智民
<div style="width: 1164px;height: 620px;box-shadow:0px 0px 1px 2px #045768, 0px 0px 0px 8px #99e5f5,0px 0px 5px 15px #045768;overflow:hidden;border-radius:1%;margin-top:130px;margin-LEFT: -165px;">
<style>
#papa {
margin: auto;
width: 1164px;
height: 620px;
overflow: hidden;
display: grid;
place-items: center;
box-shadow: 3px 6px 12px gray;
position: relative;
z-index: 1;
--state: paused;
}
#dh{ width: 100%; height: 620px; position: absolute;
z-index: 1;background: #000000 url(https://ysj147.s3-us-east-1.ossfiles.com/zzsc/bjtp/ppfengyeqing1.jpg)no-repeat center/cover;
top:0px; left:0px;
animation: rod 4s linear infinite;}
@keyframes rod{
0% {opacity: 0.6;filter:hue-rotate(360deg)}
30% {opacity: 0.3;}
60% {opacity: 0.8;}
100% {opacity: 1.0;}
}
#player {
width: 80px;
height: 80px;
left: 550px;
top: 450px;
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: 50%;
transform: translate(-50%);
top: 545px;
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%;}}
@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: -160px;;
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:610px;LEFT: 950px;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:26px;">亦是金在线音乐</span></span></span></p></div>
</style>
<div id="papa">
<div id="dh" style="animation-play-state: running;"></div>
<svg width="1164" height="620">
<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="1164" height="620" filter="url(#spot)"></rect>
</svg>
<div id="player" title="播放/暂停"></div>
<div data-lrc="" id="lrc" title="歌词显示"></div>
<audio id="aud" src="https://ysj147.s3-us-east-1.ossfiles.com/zzsc/mp3/ppfengyeqing.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); /*获得歌词数组*/
})();
dh.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>dh.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>dh.style.animationPlayState = 'paused');
</script>
亦是金老师发帖代码有溢出码,现在去了,你进去看看 效果很美哦,老师好制作 liumang 发表于 2023-12-17 17:26
亦是金老师发帖代码有溢出码,现在去了,你进去看看
好的!谢谢iumang管理!:handshake liumang 发表于 2023-12-17 17:27
效果很美哦,老师好制作
谢谢点赞!:handshake 二个制作差不多的,只是歌曲国语和粤语 亦是金 发表于 2023-12-18 22:33
谢谢点赞!
客气了
页:
[1]