你是我的梦梦梦
本帖最后由 亚伦影音工作室 于 2023-8-16 16:37 编辑 <br /><br /><style >#papa{margin: 10px -300px ;width: 1164px;box-shadow: 0px 0px 0px 2px #cccccc, 0px 0px 0px 6px #880000; overflow: hidden;
height: 680px;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%)rotateZ(0deg);
opacity:1}
6% {
-webkit-transform:rotate(0)scale(1.5)translate(0%,-10%)rotateZ(0deg);
opacity:1}
8% {
-webkit-transform:rotate(0)scale(1.5)translate(10%,0%)rotateZ(0deg);
opacity:1}
10% {
-webkit-transform:rotate(0deg)scale(1.5)translate(0%,0%)rotateZ(0deg);
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; transform: rotateX(180deg);}
#mplayer {
position: absolute;z-index: 890;
width: 30px;
height: 30px;
top:93%; left:50%;
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; }
}
#papa:hover #fullscreen { display:block ;}
#fullscreen { position: absolute; top:5%; left:83%;color:#ffffff; filter:drop-shadow( 1px 1px 1px #000000);font: normal 2.2em华文隶书; opacity: 1; cursor: pointer; z-index: 1111}
</style>
<div id="papa">
<span id="fullscreen">全屏观赏</span>
<div id="tit"></div>
<div id='dt'><img id="Img" src="https://pic.imgdb.cn/item/64dc3e57661c6c8e5412c1b9.gif" width="100%" height="100%"></div>
<div id="testImg" >
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/bfa76cbd1f1e2eddc46db16a303c6b84.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/pcwallpaper_ugc/static/42014cb258802bb1fe7bc96506aedee3.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/0b52f0a14a42b5a27908b8fd529751aa.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/2a708f2e123048f03f482eb324b2212a.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/0e9f44edbd2902404627111bac79f316.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/e280633e8ff81bfa215065607cd24ed1.jpg" />
<img alt="" class="photo" src="https://img-baofun.zhhainiao.com/fs/0bbf4ce9f0fa09fd77d979e4f4e339c1.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/614176422ab3f51d91a7138f.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/6141798a2ab3f51d91aa6423.jpg" />
<img alt="" class="photo"src="https://pic.imgdb.cn/item/642e2c05a682492fcc609190.jpg" />
<img alt=""class="photo"src="https://pic.imgdb.cn/item/6440cc3c0d2dde57773efc00.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/6444d4d20d2dde57777d1027.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/644c4c270d2dde5777f1b17f.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/645088790d2dde577794490d.jpg" />
<img alt="" class="photo" src="https://pic.imgdb.cn/item/645662e30d2dde577730c209.jpg" />
</div>
<p id="mplayer" ></p>
<div id="lrc" data-lrc="亚伦影音工作室">亚伦影音工作室</div>
</div>
<audio id="MusicPlayer" src="https://www.qqmc.com/mp3/music288958878.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 3em 华文隶书;
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();
let fs = true;
fullscreen.onclick = () => {
fs ? (fullscreen.innerText = '退出全屏', papa.requestFullscreen()) : (fullscreen.innerText = '全屏观赏', document.exitFullscreen());
fs = !fs;
};
</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:} 这首歌曲是单纯的女声演唱,歌词里怎么成了男女声对唱。呵呵,去掉那些男女标注应该很容易的啊{:4_173:} 亚伦晚上好,手机和电脑都看了,一键点击停止效果完美{:4_199:} 就是我的电脑稍微有点卡,手机可以的,我的网络问题吧 电脑全屏欣赏效果非常好{:4_199:}
页:
[1]