梦田
<style>#papa {
margin: 110px 0 0 calc(50% - 621px);
width: 1080px;
height: 721px;
background: gray url('https://638183.freep.cn/638183/t22/webp/mgtm.webp') no-repeat center/cover;
display: grid;
place-items: center;
box-shadow: 3px 3px 20px #000;
user-select: none;
overflow: hidden;
perspective: 1000px;
position: relative;
z-index: 1;
}
#mplayer {
position: absolute;
bottom: 20px;
grid-template-columns: auto auto auto;
gap: 6px;
display: grid;
place-items: center;
font: normal 16px sans-serif;
color: snow;
z-index: 999;
}
#btnplay {
margin-right: -4px;
width: 30px;
height: 30px;
font: bold 30px/30px serif;
text-align: center;
cursor: pointer;
animation: rot 4s infinite linear;
animation-play-state: var(--state);
--state: paused;
}
#prog {
width: 200px;
height: 20px;
cursor: pointer;
}
#lrc {
--state: running;
--motion: cover2;
--tt: 1s;
position: absolute;
top: 20px;
font: bold 2.4em sans-serif;
color: hsl(240, 50%, 90%);
-webkit-background-clip: text;
filter: drop-shadow(1px 1px 2px hsla(30, 10%, 10%, .95));
z-index: 1000;
}
#lrc::before {
position: absolute;
content: attr(data-lrc);
width: 20%;
height: 100%;
color: transparent;
overflow: hidden;
white-space: nowrap;
background: linear-gradient(180deg, hsla(240, 60%, 50%, .45), hsla(240, 100%, 60%, .75));
filter: inherit;
-webkit-background-clip: text;
animation: var(--motion) var(--tt) linear forwards;
animation-play-state: var(--state);
}
.star {
--rr: 300px;
position: absolute;
width: 4px;
height: 4px;
border-radius: 50% 50% 25% 50%;
transform-origin: 50% 50%;
transform-style: preserve-3d;
}
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(1turn); } }
@keyframes fly { to { transform: rotate(0) translate(0); } }
</style>
<div id="papa">
<div id="lrc" data-lrc="花潮论坛lrc在线">花潮论坛lrc在线</div>
<div id="mplayer">
<span id="btnplay">◑</span>
<meter id="prog" low="30" high="90" max="100" optimum="100" value="1"></meter>
<span id="tmsg">00:00 | 00:00</span>
</div>
</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=283101.mp3" loop autoplay></audio>
<script>
(function() {
let mKey = 0, mSeek = false, mFlag = true;
let lrcAr = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];
(function() {
Array.from({length: 100}).forEach((item,key) => {
item = document.createElement('span');
item.className = 'star';
let ww = Math.ceil(Math.random() * 20) | 10;
item.style.cssText += `
width: ${ww}px;
height: ${ww}px;
left: ${Math.random()*200 + 500}px;
top: ${Math.random()*100 + 240}px;
background: hsla(${360*Math.random()},100%,50%,.75);
transform: rotate(${Math.random() * 720}deg) translate3d(${Math.random() * 500}px,${Math.random() * 300}px,${Math.random() * 1000}px);
animation: fly 80s infinite ${-10 - Math.random() * 20}s linear;
`;
papa.appendChild(item);
});
})();
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {
prog.value = aud.currentTime / aud.duration * 100;
tmsg.innerText = `${toMin(aud.currentTime)} | ${toMin(aud.duration)}`;
for (j = 0; j < lrcAr.length; j++) {
if (aud.currentTime >= lrcAr) {
if (mKey === j) showLrc(lrcAr);
else continue;
}
}
});
let mState = () => aud.paused ? (btnplay.style.setProperty('--state', 'paused'), lrc.style.setProperty('--state', 'paused')) : (btnplay.style.setProperty('--state', 'running'), lrc.style.setProperty('--state', 'running'));
let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrc.dataset.lrc = lrcAr;lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};
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;};
})();
</script>
参考代码
<style>
#papa {
margin: 100px 0 0 calc(50% - 621px);
width: 1080px;
height: 721px;
background: gray url('https://638183.freep.cn/638183/t22/webp/mgtm.webp') no-repeat center/cover;
display: grid;
place-items: center;
box-shadow: 3px 3px 20px #000;
user-select: none;
overflow: hidden;
perspective: 1000px;
position: relative;
z-index: 1;
}
#mplayer {
position: absolute;
bottom: 20px;
grid-template-columns: auto auto auto;
gap: 6px;
display: grid;
place-items: center;
font: normal 16px sans-serif;
color: snow;
z-index: 999;
}
#btnplay {
margin-right: -4px;
width: 30px;
height: 30px;
font: bold 30px/30px serif;
text-align: center;
cursor: pointer;
animation: rot 4s infinite linear;
animation-play-state: var(--state);
--state: paused;
}
#prog {
width: 200px;
height: 20px;
cursor: pointer;
}
#lrc {
--state: running;
--motion: cover2;
--tt: 1s;
position: absolute;
top: 20px;
font: bold 2.4em sans-serif;
color: hsl(240, 50%, 90%);
-webkit-background-clip: text;
filter: drop-shadow(1px 1px 2px hsla(30, 10%, 10%, .95));
z-index: 1000;
}
#lrc::before {
position: absolute;
content: attr(data-lrc);
width: 20%;
height: 100%;
color: transparent;
overflow: hidden;
white-space: nowrap;
background: linear-gradient(180deg, hsla(240, 60%, 50%, .45), hsla(240, 100%, 60%, .75));
filter: inherit;
-webkit-background-clip: text;
animation: var(--motion) var(--tt) linear forwards;
animation-play-state: var(--state);
}
.star {
--rr: 300px;
position: absolute;
width: 4px;
height: 4px;
border-radius: 50% 50% 25% 50%;
transform-origin: 50% 50%;
transform-style: preserve-3d;
}
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
@keyframes rot { to { transform: rotate(1turn); } }
@keyframes fly { to { transform: rotate(0) translate(0); } }
</style>
<div id="papa">
<div id="lrc" data-lrc="花潮论坛lrc在线">花潮论坛lrc在线</div>
<div id="mplayer">
<span id="btnplay">◑</span>
<meter id="prog" low="30" high="90" max="100" optimum="100" value="1"></meter>
<span id="tmsg">00:00 | 00:00</span>
</div>
</div>
<audio id="aud" src="https://music.163.com/song/media/outer/url?id=283101.mp3" loop autoplay></audio>
<script>
(function() {
let mKey = 0, mSeek = false, mFlag = true;
let lrcAr = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];
(function() {
Array.from({length: 100}).forEach((item,key) => {
item = document.createElement('span');
item.className = 'star';
let ww = Math.ceil(Math.random() * 20) | 10;
item.style.cssText += `
width: ${ww}px;
height: ${ww}px;
left: ${Math.random()*200 + 500}px;
top: ${Math.random()*100 + 240}px;
background: hsla(${360*Math.random()},100%,50%,.75);
transform: rotate(${Math.random() * 720}deg) translate3d(${Math.random() * 500}px,${Math.random() * 300}px,${Math.random() * 1000}px);
animation: fly 80s infinite ${-10 - Math.random() * 20}s linear;
`;
papa.appendChild(item);
});
})();
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {
prog.value = aud.currentTime / aud.duration * 100;
tmsg.innerText = `${toMin(aud.currentTime)} | ${toMin(aud.duration)}`;
for (j = 0; j < lrcAr.length; j++) {
if (aud.currentTime >= lrcAr) {
if (mKey === j) showLrc(lrcAr);
else continue;
}
}
});
let mState = () => aud.paused ? (btnplay.style.setProperty('--state', 'paused'), lrc.style.setProperty('--state', 'paused')) : (btnplay.style.setProperty('--state', 'running'), lrc.style.setProperty('--state', 'running'));
let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrc.dataset.lrc = lrcAr;lrc.style.setProperty('--motion', name);lrc.style.setProperty('--tt', time + 's');lrc.style.setProperty('--state', 'running');mKey += 1;mFlag = !mFlag;};
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;};
})();
</script>
好听,点赞! 随着众多彩球的运动,给人一种进入太空的感觉。 这次的小珠珠变成了一只只的气球,随着背景的大圆环方向转动,如梦似幻。真漂亮{:4_199:} 黑黑的动态效果总能很好地匹配主题元素,厉害{:4_199:} 红影 发表于 2022-11-9 10:57
黑黑的动态效果总能很好地匹配主题元素,厉害
三毛的梦都是彩色的 红影 发表于 2022-11-9 10:56
这次的小珠珠变成了一只只的气球,随着背景的大圆环方向转动,如梦似幻。真漂亮
梦就是酱紫的:突然出现,突然消失 梦油 发表于 2022-11-9 10:47
随着众多彩球的运动,给人一种进入太空的感觉。
这是梦{:4_170:} 小星世龙 发表于 2022-11-9 09:18
好听,点赞!
歌老了,唱歌的人当时年轻 好听好看。制作有特点!赞!{:4_199:} 很漂亮、很精彩、很科幻!{:4_199:} 象来世的梦,在天空飘呀飘 樵歌 发表于 2022-11-9 12:31
象来世的梦,在天空飘呀飘
你认识这梦 马黑黑 发表于 2022-11-9 12:40
你认识这梦
必须在奈何桥上不喝那碗汤才行。{:4_189:} 马黑黑 发表于 2022-11-9 11:57
这是梦
进入梦境,也是很好的表现手段。 欣赏音画佳作! 相约爱晚亭 发表于 2022-11-9 16:55
欣赏音画佳作!
感谢支持 梦油 发表于 2022-11-9 16:31
进入梦境,也是很好的表现手段。
对的 樵歌 发表于 2022-11-9 12:56
必须在奈何桥上不喝那碗汤才行。
汤据说是好东西。在赫尔松,小乌龟发现大鹅留下的干粮,里面有汤,小乌龟一下子就失落了