人无再少年(Live 合唱版)-成学迅
<style type="text/css">#papa { margin: 160px 0 20px calc(50% - 621px); background:url('https://pic.imgdb.cn/item/66135afc68eb9357135ffd24.jpg') no-repeat center/cover;width: 1200px; height: 700px; box-shadow: 3px 3px 6px gray; overflow: hidden; z-index: 1; position: relative; display: grid; place-items: center; }
#png{ position: absolute; width: 100%; height: 100%;background:url('https://pic.imgdb.cn/item/66690e8dd9c307b7e9ed6d3f.png') no-repeat center/cover; z-index: 7;}
li-zi { position: absolute; width: 100px; height: 1px; border-radius: 100% 20%;background:#ffffff;border-radius: 50%;animation: imov 2s infinite;z-index: 4;}
@keyframes moving {to{ opacity: 1; transform: translate(var(--x0),var(--y0)) rotate(var(--deg)); filter:hue-rotate(0deg);}from{ opacity: 0; transform: translate(0,0) rotate(var(--deg)); }}
#mplayer {z-index: 8;
position: absolute;
left:90px;
bottom: 20px;
width: 40px;
height: 40px;
opacity: 1;
transition: .2s;
place-items: center;
--disp1: 0; --disp2: 1;
}
#mplayer::before , #mplayer::after{
position: absolute;
content: '';
cursor: pointer;
transition: .2s;
}
#mplayer::before {
width: 40px;
height: 40px;opacity: 1;
background: url("https://pic.imgdb.cn/item/666469465e6d1bfa05bd07ea.png") no-repeat center/cover;
opacity: var(--disp1);
}
#mplayer::after {
width: 40px;
height: 40px;opacity: 1;
background: url("https://pic.imgdb.cn/item/6664693a5e6d1bfa05bcf7d3.png")no-repeat center/cover;
opacity: var(--disp2);
}
#tmsg {position: absolute;z-index: 8;
font: normal 12px sans-serif;
color: #ffffff;
bottom: 30px;
left:87%;}
#prog {position: absolute;z-index: 8;
width: 70%;
height: 1.5px;
cursor: pointer;
bottom: 35px;
left:16%;
border-radius: 1px;}
#bt_prev{position: absolute;z-index: 8;
width:30px;
height: 30px;
bottom: 24px;left:40px;
background: url("https://pic.imgdb.cn/item/6664695c5e6d1bfa05bd23cb.png")no-repeat center/cover;}
#bt_pnev{position: absolute;z-index: 8;
width:30px;
height: 30px;
bottom: 24px;left:150px;
background: url("https://pic.imgdb.cn/item/66651ae45e6d1bfa0552bf2a.png")no-repeat center/cover;}
#lb{ position: absolute; bottom: 30px;right:52px; width: 22px; height: 20px;z-index: 8; }
#lb img{ width: 100%; height: 100%;}
</style>
<div id="papa">
<div id="png"></div>
<div id="testImg"> <div class="演员"></div>
<div class="演员"></div>
<div class="演员"></div>
<div class="演员"></div>
<div class="演员"></div>
<div class="演员"></div>
</div>
<div id="tmsg">00:00 | 00:00</div>
<div id="prog" title="播放进度条"></div>
<div id="bt_prev" title="无效"></div>
<div id="bt_pnev" title="无效"></div>
<div id="lb" title="喇叭"><img alt="" id="lbImg" src="https://pic.imgdb.cn/item/662615500ea9cb14035d435e.gif" /></div>
<div id="mplayer" title="暂停/播放"></div>
<div data-lrc="亚伦影音工作室" id="lrc">亚伦影音工作室</div>
</div>
<audio autoplay="" id="aud" loop="" src="https://s138.ananas.chaoxing.com/sv-w8/audio/53/17/33/f62f8b4f92de71e8d05dd89fbfb0bbdd/audio.mp3"> </audio>
<style type="text/css">#lrc {
--state: paused;
--motion: cover2;
--tt: 2s;
--bg: linear-gradient(180deg, #880000, #880000);
position: absolute;z-index: 6;
left: 40%;
transform: translate(-50%);
top: 72%;
font:normal 3em 华文隶书;
color: #000078;
white-space: pre;transform: perspective(120px) rotateY(20deg);
-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 = ` 人无再少年(Live合唱版)
人无再少年(Live 合唱版)-成学迅
词曲:耀隆
编曲:王亚东
混音:毅然音乐
合唱:毅然合唱团
吉他:LeoD
和声:小佑
制作人:耀隆
OP:星汉马文化
日思柴米夜思钱
忙碌半生未得闲
也想饮酒抱花醉
奈何月俸两三千
青丝白发一瞬间
年华老去向谁言
空有凌云千般志
负了落花负红颜
举杯含泪问苍天
为何让我入凡间
春风都有怜花意
人却不能再少年
举杯含泪问苍天
人生不过三万天
为何只许春回去
却不容我再少年
日思柴米夜思钱
忙碌半生未得闲
也想饮酒抱花醉
奈何月俸两三千
青丝白发一瞬间
年华老去向谁言
空有凌云千般志
负了落花负红颜
举杯含泪问苍天
为何让我入凡间
春风都有怜花意
人却不能再少年
举杯含泪问苍天
人生不过三万天
为何只许春回去
却不容我再少年
举杯含泪问苍天
为何让我入凡间
春风都有怜花意
人却不能再少年
举杯含泪问苍天
人生不过三万天
为何只许春回去
却不容我再少年
`;
/*变量 :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><script>
let mState = () => aud.paused ? (mplayer.style.setProperty('--disp1','1'), mplayer.style.setProperty('--disp2','0')) : (mplayer.style.setProperty('--disp1','0'), mplayer.style.setProperty('--disp2','1'));
mplayer.onclick =function() { aud.paused ?(aud.play(),imagelb.play()): ( aud.pause(),imagelb.stop())};
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
var imagelb= document.getElementById("lbImg");
(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());
})();
/*进度条 进度时间*/
prog.onclick = (e) => {
aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
}
aud.addEventListener('timeupdate', () => {
aud.addEventListener('timeupdate', () => {prog.style.background= 'linear-gradient(90deg, #ff0000, #ff0000, #ff0000 '+ aud.currentTime / aud.duration * 100 + '%, #eeeeee 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>
/*以下是控制动图的插件*/
if ('getContext' in document.createElement('canvas')) {
HTMLImageElement.prototype.play = function() {
if (this.storeCanvas) {
// 移除存储的canvas
this.storeCanvas.parentElement.removeChild(this.storeCanvas);
this.storeCanvas = null;
// 透明度还原
imagelb.style.opacity = '';
}
if (this.storeUrl) {
this.src = this.storeUrl;
}
};
HTMLImageElement.prototype.stop = function() {
var canvas = document.createElement('canvas');
// 尺寸
var width = this.width, height = this.height;
if (width && height) {
// 存储之前的地址
if (!this.storeUrl) {
this.storeUrl = this.src;
}
// canvas大小
canvas.width = width;
canvas.height = height;
// 绘制图片帧(第一帧)
canvas.getContext('2d').drawImage(this, 0, 0, width, height);
// 重置当前图片
try {
this.src = canvas.toDataURL("image/gif");
} catch(e) {
// 跨域
this.removeAttribute('src');
// 载入canvas元素
canvas.style.position = 'absolute';
// 前面插入图片
this.parentElement.insertBefore(canvas, this);
// 隐藏原图
this.style.opacity = '0';
// 存储canvas
this.storeCanvas = canvas;
}
}
};
}
</script>
<style type="text/css">.演员 {
width: 40%;
height: 40%;
position: absolute;
z-index: 1;
top:50px; left:90px;-webkit-mask: radial-gradient(circle at 50% center, black 50%, transparent 50%, transparent 0); box-shadow: inset 0 20px 280px rgba(0,0,128,1), 0 20px 136px rgba(0,0,128,1);
animation: spin 36s infinite linear;
opacity: 0;
}
.演员:nth-of-type(6) {animation-delay: 30s;
background: url('https://pic.imgdb.cn/item/66690afed9c307b7e9e8c6f8.jpg')no-repeat -120px 0px/cover;
}
.演员:nth-of-type(5) {animation-delay: 24s;
background: url('https://pic.imgdb.cn/item/658c0a24c458853aef9d89ab.jpg')no-repeat center/cover;
}
.演员:nth-of-type(4) {animation-delay: 18s;
background: url('https://pic.imgdb.cn/item/658c09d6c458853aef9c646b.jpg')no-repeat center/cover;
}
.演员:nth-of-type(3) {animation-delay: 12s;
background: url('https://pic.imgdb.cn/item/65db15629f345e8d03a78591.jpg')no-repeat center/cover;
}
.演员:nth-of-type(2) {animation-delay: 6s;
background:url('https://pic.imgdb.cn/item/666909d8d9c307b7e9e73532.jpg')no-repeat -100px 0px/cover;
}
.演员:nth-of-type(1) {animation-delay: 0s;
background: url(https://pic.imgdb.cn/item/65db13539f345e8d03a32d0b.jpg)no-repeat center/cover;
}
.stop .演员:nth-child(1),
.stop .演员:nth-child(2),
.stop .演员:nth-child(3),
.stop .演员:nth-child(4),
.stop .演员:nth-child(5),
.stop .演员:nth-child(6){animation-play-state: paused;}
@keyframes spin {
0% { opacity: 0;transform: translate(-150%,-50%); }
8% { opacity: 1;transform:scale(1) translate(50%,50%); }
10% { opacity: 1;transform:scale(1) translate(50%,50%)rotateY(90deg); }
12% { opacity: 1;transform:scale(1) translate(50%,50%)rotate(0deg); }
14% { opacity: 1;transform:scale(1) translate(50%,10%); }
16% { opacity: 1;transform:scale(1)translate(50%,70%) }
18% { opacity: 1;transform:scale(1)translate(50%,50%) }
20% { opacity: 0;transform:scale(1)translate(180%,-100%) }
}
</style>
<script>
(function() {
let all = 200;
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(16).substr(-6)};
animation: moving ${Math.random() * 2 + 2}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>
{:5_150:}{:5_150:}{:5_150:} 亚伦老师好制作{:5_150:}
页:
[1]