《浪子心声》(学习黑黑方寸一席效果)
<style>
#papa {
margin: 80px 0 0 calc(50% - 681px);
width: 1200px;
height: 700px;
box-shadow: 4px 8px 28px gray;
background: url('https://pic.imgdb.cn/item/658b8e39c458853aef00b020.jpg') no-repeat center/cover;
overflow: hidden;
z-index: 1;
position: relative;
--state: paused;
}
#player {
position: absolute; z-index: 2;
left: 460px;
top: 100px;
width: 580px;
height: 580px;
cursor: pointer;
animation: rotating 6s infinite alternate linear var(--state);
}
li-zi {
position: absolute;
width: 32px;
height: 66px;
background: navy;
opacity: 1;
animation: moving var(--duration) var(--delay) linear infinite alternate var(--state);
}
#vid {
position: absolute;
top: -60px;
width: 1200px;
height: 760px;
opacity: .30;
mix-blend-mode: screen;
object-fit: cover;
pointer-events: none;
}
#lrc { --motion: cover1; --tt: 5s; --state: paused; position: absolute; left: 50%; transform: translate(-50%); top: 10px; font: bold 2.8em sans-serif; color: hsl(300, 100%, 100%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0, 0%, 0%, .95)); }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: pre; background: linear-gradient(180deg, hsla(0, 100%, 50%, .45), hsla(32, 100%, 66%, .6), hsla(60, 100%, 50%, .75)); filter: inherit; -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%; } }
@keyframes moving {
from { transform: translate(var(--x0),var(--y0)) rotate(var(--deg)); }
to { transform: translate(var(--x1),var(--y1)) rotate(var(--deg)); }
}
@keyframes rotating { to { transform: rotate(360deg); } }
</style>
<div id="papa">
<video id="vid" src="https://img.tukuppt.com/video_show/2475824/00/01/72/5b491dd2b9164_10s_big.mp4" autoplay loop muted></video>
<audio id="aud" src="http://www.kumeiwp.com/sub/filestores/2023/04/03/13cba3b98cce88242212ca4f1fbabb03.mp3" autoplay loop></audio>
<div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
<div id="player" title="播放/暂停"></div>
</div>
<script>
(function() {
let vid = document.querySelector('#vid');
let r = player.offsetWidth / 2 - 18, total = 40;
Array.from({length: total}).forEach((item,key) => {
let rad0 = (Math.PI / 180) * 360 / total * key,
rad1 = (Math.PI / 180) * (180 + (360 / total * key));
item = document.createElement('li-zi');
item.style.cssText += `
--x0: ${r + r * Math.cos(rad0)}px;
--y0: ${r + r * Math.sin(rad0)}px;
--x1: ${r + r * Math.cos(rad1)}px;
--y1: ${r + r * Math.sin(rad1)}px;
--deg: ${360 / total * key}deg;
--duration: ${4 + Math.random() * 6}s;
--delay: -${Math.random() * 8}s;
background: url('https://pic.imgdb.cn/item/658bca64c458853aefcb25f6.png') no-repeat center/cover;
`;
player.appendChild(item);
});
let mKey = 0, mFlag = true;
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
let mState = () => {
aud.paused ?
(papa.style.setProperty('--state','paused'), lrc.style.setProperty('--state', 'paused'), vid.pause()) :
(papa.style.setProperty('--state','running'), lrc.style.setProperty('--state', 'running'), vid.play());
};
let showLrc = (time) => {let name = mFlag ? 'cover1' : 'cover2';lrc.innerHTML = lrcAr;lrc.dataset.lrc = lrcAr.replace(/<br>/, '\n');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);};
aud.addEventListener('timeupdate', () => {for(let j = 0; j < lrcAr.length; j ++) {if (aud.currentTime >= lrcAr) {if (mKey === j) showLrc(lrcAr);else continue;}}});
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('playing', mState, false);
aud.addEventListener('pause', mState, false);
player.onclick = () => aud.paused ? aud.play() : aud.pause();
})();
</script> 这个貌似母球背景出不来,不过也不需要那个背景,正好{:4_173:} 把小球换成了文字@马黑黑,反正点那个名利场就能暂停{:4_173:} 在歌厅里听到一个朋友唱这个,感觉歌词挺好,正好作为作业,拿这首歌用来学习了{:4_204:} 嗬!看得我眼花缭乱,哈哈哈…… 梦油 发表于 2023-12-27 21:24
嗬!看得我眼花缭乱,哈哈哈……
这就对了,名利迷人眼。那些飘飞的就是名利二字啊{:4_173:} 梦油 发表于 2023-12-27 21:24
嗬!看得我眼花缭乱,哈哈哈……
点那些飘飞的可以停下,停了就看出来了{:4_172:} 红影 发表于 2023-12-27 20:05
把小球换成了文字@马黑黑,反正点那个名利场就能暂停
这也是一种创意 马黑黑 发表于 2023-12-27 21:48
这也是一种创意
主要想起这首歌了,就按这个意思开始开始凑图图和相关内容了{:4_173:} 红影 发表于 2023-12-27 21:32
这就对了,名利迷人眼。那些飘飞的就是名利二字啊
我还真没注意呢。 红影 发表于 2023-12-27 21:33
点那些飘飞的可以停下,停了就看出来了
哦,我去看看。 哇塞~~~粤语的浪子心声,好听极了{:4_199:} 后面几句口哨声音也是绝{:4_199:} 好听好看,不赞都不行{:4_178:} 红影 发表于 2023-12-27 22:42
主要想起这首歌了,就按这个意思开始开始凑图图和相关内容了
挺好挺好 梦油 发表于 2023-12-28 11:09
我还真没注意呢。
点击一下,停下来了,就看得出来了{:4_173:} 梦油 发表于 2023-12-28 11:10
哦,我去看看。
能够停的吧{:4_173:} 世外桃源 发表于 2023-12-28 11:42
哇塞~~~粤语的浪子心声,好听极了
这歌挺经典,听到别人唱,还挺喜欢这个歌词的{:4_173:} 世外桃源 发表于 2023-12-28 11:44
后面几句口哨声音也是绝
是的,那口哨声很好听。 世外桃源 发表于 2023-12-28 11:46
好听好看,不赞都不行
谢谢桃源鼓励{:4_187:}