想念很狼狈 (DJ版) - 影子
本帖最后由 亚伦影音工作室 于 2023-8-16 09:32 编辑 <br /><br /><style >#papa{margin: 10px 30px ;width: 450px;box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 6px #880000; overflow: hidden;
height: 720px;border: 1px solid;background: #333 ; position: relative;z-index: 12345;}
.photo {width: 100%;
height: 100%;
position: absolute;z-index: 2;
top:0px; left:0px;
opacity: 0;
animation: round 270s linear infinite;}
@keyframes round{
0% {
-webkit-transform:rotate(0)scale(1)translate(0%,0%);
opacity:0}
2% {
-webkit-transform:rotate(0)scale(1.5)translate(-10%,0%);
opacity:1}
4% {
-webkit-transform:rotate(0)scale(1.5)translate(0%,10%);
opacity:1}
6% {
-webkit-transform:rotate(0)scale(1.5)translate(0%,-10%);
opacity:1}
8% {
-webkit-transform:rotate(0)scale(1.5)translate(10%,0%);
opacity:1}
10% {
-webkit-transform:rotate(0deg)scale(1.5)translate(0%,0%);
opacity:0}
}
img:nth-child(1) {animation-delay: 252s;}
img:nth-child(2) {animation-delay: 234s;}
img:nth-child(3) {animation-delay: 216s;}
img:nth-child(4) {animation-delay: 198s;}
img:nth-child(5) {animation-delay: 180s;}
img:nth-child(6) {animation-delay: 162s;}
img:nth-child(7) {animation-delay: 144s;}
img:nth-child(8) {animation-delay: 126s;}
img:nth-child(9) {animation-delay: 108s;}
img:nth-child(10){animation-delay: 90s;}
img:nth-child(11){animation-delay: 72s;}
img:nth-child(12){animation-delay: 54s;}
img:nth-child(13){animation-delay: 36s;}
img:nth-child(14) {animation-delay: 18s;}
img:nth-child(15) {animation-delay: 0s;}
.stop img:nth-child(1),
.stop img:nth-child(2),
.stop img:nth-child(3),
.stop img:nth-child(4),
.stop img:nth-child(5),
.stop img:nth-child(6),
.stop img:nth-child(7),
.stop img:nth-child(8),
.stop img:nth-child(9),
.stop img:nth-child(10),
.stop img:nth-child(11),
.stop img:nth-child(12),
.stop img:nth-child(13),
.stop img:nth-child(14),
.stop img:nth-child(15){animation-play-state: paused;}
#dt{position: absolute;top:0%; left:0%;width: 100%;height: 100%;mix-blend-mode: lighten;z-index: 3; }
#mplayer {
position: absolute;z-index: 890;
width: 30px;
height: 30px;
top:90%; left:45%;
border: 2px solid #FFFFFF;
border-radius: 50%;
box-shadow: 0 0 10px #00FF00;
transition: .7s;
cursor: pointer;
display: grid;
place-items: center;
--play: 1; --pause: 0; --bd: black; --sd: black;
}
#mplayer::before, #mplayer::after {
position: absolute;
content: '';
border-style: solid;
border-color: #FFFFFF;
transition: .2;
}
#mplayer::before {
width: 0;
height: 0;
left: 10px;
border-width: 10px 12px;
border-color: transparent transparent transparent #FFFFFF;
opacity: var(--play);
}
#mplayer::after {
width: 2px;
height: 16px;
border-width: 0 4px 0 4px;
opacity: var(--pause);
}
#mplayer:hover { box-shadow: 0 0 6px #000000, 0 0 6px #000000 inset; }
#tit {position: absolute;
width: fit-content;
height: fit-content;
left:5%;top:30px;
z-index: 12;
color: #ff0000;
filter:drop-shadow(#FFFFFF 1px 0 0)drop-shadow(#FFFFFF 0 1px 0)drop-shadow(#FFFFFF -1px 0 0) drop-shadow(#FFFFFF 0 -1px0);
font: normal 25px/32px '华文隶书',serif;
}
.mysp {position: relative;
display: block;
}
@keyframes move {
0% { left: 10px;top:0px; transform: rotate(0); color: #000080; }
50% {left:150px;top:0px; transform: rotate(360deg); color: red; }
100% {left:10px;top:0px; transform: rotate(720deg); color: green; }
}
</style>
<div id="papa">
<div id="tit"></div>
<div id='dt'><img id="Img" src="https://pic.imgdb.cn/item/644e2e6c0d2dde5777e7add9.gif" width="100%" height="100%"></div>
<div id="testImg" >
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/f40fdf43294f0efe318970b1004c59c9.jpg" />
<img alt="" class="photo"src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/b2043f79eb48000b37038244f6fa577c.png" />
<img alt=""class="photo"src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/672a72714b2577a9cb2a9d5a5d2bca3d.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/73e711e5e4723e3fbdbaaa3959d2ea32.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/9060a239e5c80fe3b84fa88e1c76742a.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/233263b1f69a1d1678cac629150a4825.png" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/91e3b3fd964d9bbe9b028ecda3bec9c9.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/909c097412b8ae28b439220357b696ca.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/ccb8ece704239ef6a1d417a1ebfa54d2.jpg" />
<img alt="" class="photo"src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/3a82644771e1f0f4252c047200539a93.png" />
<img alt=""class="photo"src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/3883d7322189c5ac9a5fab76b267d8e8.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/d664f3f83afe85ec868a55376b03680c.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/9c42a95782bd760ffe0259cb0feab0fb.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/401e3a3fd7e475868d6f465bca9ca65f.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc_mobile/static/af91e5cfec658a348c97c3cca9fa373e.jpg" />
</div>
<p id="mplayer" ></p>
<div id="lrc" data-lrc="亚伦影音工作室">亚伦影音工作室</div>
</div>
<audio id="MusicPlayer" src="https://www.qqmc.com/mp3/music287962093.mp3" loop autoplay></audio>
<style>
#lrc {
--state: paused;
--motion: cover2;
--tt: 2s;
--bg: linear-gradient(180deg, #880000, #880000);
position: absolute;
left: 50%;z-index: 2;
transform: translate(-50%);
top: 82%;
font:normal 2em 华文隶书;
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 {from { width: 0;filter:hue-rotate(0deg)brightness(350%); } to { width: 100%;filter:hue-rotate(360deg)brightness(200%)} }
@keyframes cover2 { from { width: 0;filter:hue-rotate(0deg)brightness(350%); } to { width: 100%;filter:hue-rotate(360deg)brightness(200%)} }
</style>
<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 (MusicPlayer.currentTime <= lrcAr) {
mKey = j - 1;
break;
}
}
if (mKey < 0) mKey = 0;
if (mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;
let time = lrcAr - (MusicPlayer.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 = () => MusicPlayer.paused ? (lrc.style.setProperty('--state','paused'),mplayer.style.animationPlayState = 'paused') : (lrc.style.setProperty('--state','running'),mplayer.style.animationPlayState = 'running');
/*监听播放进度*/
MusicPlayer.addEventListener('timeupdate', () => {
for (j = 0; j < lrcAr.length; j++) {
if (MusicPlayer.currentTime >= lrcAr) {
cKey = j;
if (mKey === j) showLrc(lrcAr);
else continue;
}
}
});
MusicPlayer.addEventListener('pause', () => mState());/*监听暂停事件*/
MusicPlayer.addEventListener('play', () => mState());/*监听播放事件*/
MusicPlayer.addEventListener('seeked', () => calcKey());/*监听查询事件*/
let lrcAr = getLrcAr(lrcStr); /*获得歌词数组*/
})();
mplayer.style.animationPlayState = MusicPlayer.paused ? 'paused' : 'running';
MusicPlayer.addEventListener('playing', () =>mplayer.style.animationPlayState = 'running');
MusicPlayer.addEventListener('pause', () =>mplayer.style.animationPlayState = 'paused');
let spans = [],idx = 0, last = null;
[...'想念很狼狈DJ版-影子'].forEach((item,key) => {
let sp = document.createElement('span');
sp.className = 'mysp';
sp.innerHTML = item + '<br>';
spans.push(sp);
tit.appendChild(sp);
});
let mov = () => {
if(last != null) spans.style.animation = '';
spans.style.animation = 'move 2s';
last = idx;
idx += 1;
if(idx >= spans.length) idx = 0;
setTimeout(mov,2000);
};
mov();
</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("Img");
var imagee= document.getElementById("testImg");
let mState = () => MusicPlayer.paused ? (mplayer.style.setProperty('--play', '1'),image.stop(),imagee.classList.add('stop') ,mplayer.style.setProperty('--pause', '0')) : (mplayer.style.setProperty('--play', '0'), image.play(),imagee.classList.remove('stop'),mplayer.style.setProperty('--pause', '1'));
mplayer.onclick = () => MusicPlayer.paused ? MusicPlayer.play() : MusicPlayer.pause();
MusicPlayer.addEventListener('play', mState,false);
MusicPlayer.addEventListener('pause', mState,false);
</script> 图片间隔时间没有计算好!
亚伦晚上好,我手机欣赏效果很好{:4_199:} 明天电脑再上去看看,手机可以控制停止音乐和图片 亚伦影音工作室 发表于 2023-8-15 22:13
图片间隔时间没有计算好!
重新计算好,再做一个出来{:4_189:} 图图好美啊,这样美的帖子真是视听的美好享受。欣赏亚伦老师好帖{:4_199:} 意境唯美,制作精致细腻,超赞。
页:
[1]