爱上小城爱上你 (DJ何鹏版) - 郭玲[歌词没有校正]
本帖最后由 亚伦影音工作室 于 2023-3-25 08:27 编辑 <br /><br /><style>#papa {
margin: 10px -303px;
width: 1164px;
height: 620px;
background: #000000 url('https://img-baofun.zhhainiao.com/fs/scene/preview_img_raw/663bf23e7639740c41045affdbb1ea27_preview_raw.jpg') center/cover no-repeat;
box-shadow: 3px 3px 0px #000;
position: relative;
z-index: 1;
--state: paused;
}
#dt{position: absolute;top:-10%; left:0%;z-index: 2;
width:600px;
height:460px; transition: .3s all ease;/*一定要加上不然看着突兀*/}
#mplayer {
width: 80px;
height: 160px;
left: 10px;
bottom: 10px;
background: black;
border-radius: 8px;
box-shadow: 6px 4px 12px snow;
transition: .6s;
position: absolute;
pointer-events: none;
}
#mplayer::before, #mplayer::after {
position: absolute;
content: '';
}
#mplayer::before {
width: 30px;
height: 30px;
left: calc(50% - 15px);
bottom: 15px;
border-radius: 50%;
background: #333;
pointer-events: auto;
cursor: pointer;
border: 2px solid snow;
box-shadow: 0 0 10px blue;
animation: flash .3s infinite alternate var(--state);
}
#mplayer::after {
content:attr(data-tt);
top: 6px; right: 6px; bottom: 60px; left: 6px;
background: #333;
color: lightblue;
font-size: 14px;
text-align: center;
padding: 4px;
white-space:pre;
}
#mplayer:active { transform: rotate(5deg); }
#vid { display: none; }
#canv {
position: absolute;
display: block;
right: 0px;
top: 0px;
border-radius: 0%;
opacity: 1;
}
@keyframes flash {
to { box-shadow: 0 0 30px white; }
}
</style>
<div id="papa">
<div id='dt'><img id="testImg" src="https://pic.imgdb.cn/item/641a8a2fa682492fcc039198.gif" width="100%" height="100%"></div>
<canvas id="canv"></canvas>
<divid="testBtn"><div id="mplayer" data-tt="HCPlayer 00:00 00:00"></div></div>
<div data-lrc="亚伦影音工作室" id="lrc">亚伦影音工作室</div>
</div>
<audio id="aud" src="https://p4.t57.cn:8399/2022/zw/1/HXD.m4a" autoplay loop></audio>
<video id="vid" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/preview/097d22b11081d458bc107813f27f7dc0_preview.mp4" loop autoplay muted></video>
<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));
mplayer.addEventListener('click', () => aud.paused ? aud.play() : aud.pause());
</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 = `
爱上小城爱上你 (DJ何鹏版) - 郭玲
词:李卫强
曲:何鹏
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>
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_178:} 太美不得不爱{:5_106:} 制作精彩,视频高清!好听好看!喜欢!!!{:4_191:} 太美,太精彩,舍不得走开{:4_189:}{:4_190:} 好靓丽的画面,太美了{:4_199:}
页:
[1]