《妹比桃花还好看》(试帖亚伦老师代码)
本帖最后由 亦是金 于 2023-12-20 16:05 编辑 <br /><br /><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>《小琢歌曲选听 3》</title></head>
<TABLEid=gao style="BORDER-RIGHT: #fbbf1d 6px ridge; BORDER-TOP: #fbbf1d 6px ridge; LEFT: -80px; TOP: 50px;BORDER-LEFT: #fbbf1d 6px ridge; WIDTH: 1174px; BORDER-BOTTOM: #fbbf1d 6px ridge; POSITION: relative; " borderColor=#059D82 height=630 cellSpacing=0 cellPadding=0 width=1174 bgColor=#000000>
<TBODY>
<TR>
<TD>
</head>
<style type="text/css">
#bj{position: relative;width: 1164px;height: 620px;MARGIN-LEFT:0px;margin-top:-90px;;overflow:hidden;background:url('https://z4a.net/images/2023/12/03/HOqLUH.jpg')no-repeat center / cover;--opt: .2;}
#mplayer{
width: 80px;
height: 80px;
position: absolute;
left: 8%;
top: 65%;
background: url('https://ysj147.s3-us-east-1.ossfiles.com/zzsc/png/四叶草02g.png') no-repeat center/cover;
animation: spin 18s linear infinite;
}
@keyframes spin {
0% { transform: rotate(-360deg)scale(1);filter:hue-rotate(360deg)contrast(100%)brightness(150%); }
50% { transform: rotate(0deg)scale(1);filter:hue-rotate(0deg)contrast(100%)brightness(100%); opacity: 1;}
100% { transform: rotate(360deg)scale(1);filter:hue-rotate(0deg)contrast(100%)brightness(100%); opacity: 1;}
}
#tmsg {position: absolute;z-index:2 ;
font: normal 12px sans-serif;
color: #ffffff;
top:500px;
left:8%;}
#prog {position: absolute;z-index:2 ;
width: 100%;
height: 3%;
cursor: pointer;
top:97%;
margin:0px 0%;
border-radius: 0px;}
#canv {display: block; position: absolute;
width:100%;
height: 200px;
bottom: 20px;
left: 0px;
z-index:1 ;
animation: sp 1s linear infinite;}
@keyframes sp {
0% { filter:hue-rotate(360deg)contrast(150%)brightness(100%); }
}
#dt{position: absolute;top:0%; left:0%;width: 100%;height: 100%;z-index:1; mix-blend-mode:soft-light; }
</style>
<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: 0px;
left: -100px;;
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:520px;LEFT: 960px;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:24px;">亦是金在线音乐</span></span></span></p></div>
</style>
<divid="bj">
<div id="dt"><img id="Img" src="https://z4a.net/images/2023/12/20/bianse01.gif" width="100%" height="100%"></div>
<div id="mplayer"></div>
<divid="prog"></div>
<div id="tmsg">00:00 | 00:00</div>
<div data-lrc="" id="lrc"></div>
<canvas id='canv' width="1200" height="250"></canvas>
<audio autoplay="" id="aud" loop="" src="https://mp3.t57.cn:7087/kwlink_d.php?id=262318809.mp3" crossOrigin="anonymous"> </audio>
</div>
<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: 85%;
font:normal 3em 华文隶书;
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 = `《妹比桃花还好看》
作词:轻云望月/且行且歌
作曲:轻云望月
演唱:小琢/望海高歌
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); /*获得歌词数组*/
})();
mplayer.addEventListener('click', () => { aud.paused ? aud.play() : aud.pause(); });
mplayer.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>mplayer.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>mplayer.style.animationPlayState = 'paused');
prog.onclick = (e) => {
aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
}
aud.addEventListener('timeupdate', () => {
aud.addEventListener('timeupdate', () => {prog.style.background= 'linear-gradient(90deg, #006400, #006400, #ff0000 ' + aud.currentTime / aud.duration * 100 + '%, #2F4F4F 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>
<script>
(function () {
let Act = new AudioContext();
let audSrc = Act.createMediaElementSource(aud);
let analyser = Act.createAnalyser();
audSrc.connect(analyser);
analyser.connect(Act.destination);
let ctx = canv.getContext('2d');
let width = canv.width;
let height = canv.height;
let ppColor = ctx.createLinearGradient(350,200,350,0);
ppColor.addColorStop(0.6, '#ff0000');
ppColor.addColorStop(0.4, '#00ff00');
ppColor.addColorStop(0, '#00ff00');
let ppNum = 200;
let voiceHeight = new Uint8Array(analyser.frequencyBinCount);
(function draw() {
analyser.getByteFrequencyData(voiceHeight);
let step = Math.round(voiceHeight.length / ppNum);
ctx.clearRect(0, 0, width, height);
for (let j = 0; j < ppNum; j++) {
let audiheighteight = voiceHeight;
ctx.fillStyle = ppColor;
ctx.fillRect(width / 2 + (j * 8), height, 4, -audiheighteight);
ctx.fillRect(width / 2 - (j * 8), height, 4, -audiheighteight);
}
window.requestAnimationFrame(draw);
})();
canv.onclick = () => aud.paused ? aud.play() : aud.pause();
})();
</script>
</TD></TR></TBODY></TABLE>
<DIV style="HEIGHT: 50px"></DIV>
帖子不错 音乐好听 admin 发表于 2023-12-20 16:16
帖子不错 音乐好听
问好admin管理!谢谢点赞!{:5_116:} {:5_150:}{:5_150:}{:5_150:} {:5_150:}{:5_150:}{:5_150:}
漂亮~~ liumang 发表于 2023-12-20 22:44
问好管理!谢谢欣赏!{:5_116:} 小辣椒 发表于 2023-12-26 22:38
漂亮~~
问好小辣椒!谢谢欣赏点赞!{:5_116:} 试贴。。。。。?
不是正式贴吗?
页:
[1]