一半疯了一半算了(合唱版)-苏谭谭/3 秒超市/宋小睿
<style>#papa {
margin: 10px -300px;
width: 1164px;
height: 620px;
background: linear-gradient(41deg, rgba(251, 7, 7, 0.33) 0%,rgba(6, 19, 157, 0.31) 44%,rgba(19, 233, 63, 0.56) 100%),url('http://chuangshicdn.data.mvbox.cn/album/22/06/29/22062918314029952954.jpg')0 0/100% 100%;
position: relative;
z-index: 1;overflow: hidden;}
#dt{position: absolute;top:0%; left:0%;z-index: 1;
width:1164px;
height:620px; transition: .3s all ease;/*一定要加上不然看着突兀*/}
#gj {top:20%; left:-10%;z-index: 20;
position: absolute;transform:scale(0.4);
width: 500px;
height: 500px;}
#xzcp {top:38%; left:16%;z-index: 1;
position: absolute;
width: 180px;
height: 180px;
cursor:pointer;
border-radius: 50%;
background:url(https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/b0bea37f1dff1ba2977e3d3cdf8cf8ea.jpg)-30px 0px/170% 100%;
border:42px solid #000000; box-shadow: 0px 0px 2px 1px #eeeeee, 0px 0px 0px 60px #000000, 0px 0px 5px 65px #eeeeee;
animation: spin 10s infinite linear ;}
@keyframes spin {100% { transform: rotate(360deg);opacity: 1; }
}
#mplayer {position: absolute;
top:0%; left:0%;z-index: 20;
width: 500px;
height: 500px;
cursor: pointer;}
.pink { background: url('https://s1.ax1x.com/2022/07/18/jo4wIH.png')0 0/100% 100%;transform:rotate(-2deg);transform-origin: 100% 0%;}
.purple { background: url('https://s1.ax1x.com/2022/07/18/jo4wIH.png')0 0/100% 100%; transform-origin: 75% 0%;margin: 25px -32px;transform:rotate(-20deg);}
#vid { display: none; }
#canv { mix-blend-mode:soft-light;
position: absolute;
display: block;z-index: 2;
top:0%; left:0%;
lip-path: polygon(0 19%, 13% 19%, 13% 0, 54% 0, 54% 9%, 100% 9%, 100% 84%, 76% 84%, 76% 92%, 61% 92%, 61% 100%, 30% 100%, 30% 89%, 0 89%);
opacity: 1;
}
</style>
<div id="papa">
<div id="dh"></div>
<div id='dt'><img id="testImg" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/f6cc522c7898beb7f003ec7c9c3a49f1.jpg" width="100%" height="100%"></div>
<div id="gj" >
<div id="xzcp" ></div>
<divid="testBtn"><div id="mplayer" class="pink"></div></div>
</div>
<canvas id="canv"></canvas>
<div data-lrc="一半疯了一半算了" id="lrc">一半疯了一半算了</div>
</div>
<audio id="aud" src="https://www.qqmc.com/mp3/music268572026.mp3" autoplay loop></audio>
<video id="vid" src="https://img.tukuppt.com/video_show/2629112/00/02/03/5b4f387d4d4ef.mp4" loop autoplay muted></video>
<script>
let flag = true;
mplayer.onclick = () => {
flag ? mplayer.classList.add('purple') : mplayer.classList.remove('purple');
flag = !flag;
};
</script>
<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 = `一半疯了一半算了(合唱版)-苏谭谭/3 秒超市/宋小睿
词:宋普照
曲:花僮
编曲:关剑
和声:宋马超
混音:王亚东
出品人:亚伦
创意:亚伦影音工作室
宋小睿:
熙熙攘攘这命运的道场
谁曾燃起希望烧一片空旷
3 秒超市:
多少心的滚烫开不出花香
有梦的人也许最迷茫
苏谭谭:
就怪那酒杯太浅 敬不了来日方长
巷子太短 走不到白发苍苍
3 秒超市:
这一生一半疯了 一半算了
不是年少不疯狂 只是岁月太荒唐
宋小睿:
就怪那岁催人老 贪不起一如既往
笑谈风霜 留一副冠冕堂皇
合:
这一生一半疯了 一半算了
再对烈酒诉衷肠 只能说说旧时光
宋小睿:
熙熙攘攘这命运的道场
谁曾燃起希望烧一片空旷
3 秒超市:
多少心的滚烫开不出花香
有梦的人也许最迷茫
苏谭谭:
就怪那酒杯太浅 敬不了来日方长
巷子太短 走不到白发苍苍
3 秒超市:
这一生一半疯了 一半算了
不是年少不疯狂 只是岁月太荒唐
宋小睿:
就怪那岁催人老 贪不起一如既往
笑谈风霜 留一副冠冕堂皇
苏谭谭:
这一生一半疯了 一半算了
再对烈酒诉衷肠 只能说说旧时光
宋小睿:
就怪那酒杯太浅 敬不了来日方长
3 秒超市:
巷子太短 走不到白发苍苍
苏谭谭:
这一生一半疯了 一半算了
不是年少不疯狂 只是岁月太荒唐
合:
就怪那岁催人老 贪不起一如既往
笑谈风霜 留一副冠冕堂皇
这一生一半疯了 一半算了
再对烈酒诉衷肠 只能说说旧时光
`;
/*变量 :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());
xzcp.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>xzcp.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>xzcp.style.animationPlayState = 'paused');
before.style.animationPlayState = aud.paused ? 'paused' : 'running';
aud.addEventListener('playing', () =>before.style.animationPlayState = 'running');
aud.addEventListener('pause', () =>before.style.animationPlayState = 'paused');
})();
</script>
<script>
let ctx = canv.getContext('2d');
let ww = canv.width =1164, hh = canv.height =620;
let loop = () => {ctx.drawImage(vid, 0, 0, ww, hh);if(!vid.paused) {requestAnimationFrame(loop);return;}}
let toMin = (val) => {if (!val) return '00:00';val = Math.floor(val);let min = parseInt(val / 60),sec = parseFloat(val % 60);if (min < 6) min = '0' + min;if (sec < 6) sec = '0' + sec;return min + ':' + sec;};
let mState = () => aud.paused ? (papa.style.setProperty('--state', 'paused'),vid.pause()) : (papa.style.setProperty('--state', 'running'),vid.play());
vid.playbackRate = 0.5;
vid.addEventListener('play', loop, false);
aud.addEventListener('play', () => mState());
aud.addEventListener('pause', () => mState());
aud.addEventListener('timeupdate', () => mplayer.dataset.tt = '\n\n' + toMin(aud.duration) + '\n' + toMin(aud.currentTime));
</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;
// 透明度还原
image.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;
}
}
};
}
var image = document.getElementById("testImg"),
button = document.getElementById("testBtn");
if (image && button) {
button.onclick = function() {
if (this.value == '') {
image.play();
this.value = '.';
} else {
image.stop();
this.value = '';
}
};
}
</script>
欣赏老师佳作!{:4_187:} 欣赏美好的东东。 制作的太漂亮了{:4_187:} 非常漂亮的制作,欣赏亚伦老师好帖{:4_199:} 美女播放器漂亮,欣赏点赞!{:4_180:}
页:
[1]