夕阳下
<style>#papa {
margin: 100px 0 0 calc(50% - 681px);
width: 1200px;
height: 675px;
background: gray url('https://s1.ax1x.com/2022/11/10/zpo6U0.jpg') 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; left: 100px;
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: 60px;
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://pan.365.tf/uploads/dengkh/橄榄树-黑鸭子.mp3" loop autoplay></audio>
<script>
(function() {
let mKey = 0, mSeek = false, mFlag = true;
let lrcAr = [
['0.71', '橄 榄 树',7.5],
['8.57', '黑鸭子演唱组 :橄榄树',6.3],
['15.18', '词: 三毛 曲: 李泰祥',3.8],
['19.22', 'LRC歌词制作 相约爱晚亭',19.8],
['40.01', '不要问我从那里来',5.5],
['45.83', '我的故乡在远方',5.7],
['51.80', '为什么流浪',4.8],
['56.82', '流浪远方 流浪',14.3],
['71.86', '为了天空飞翔的小鸟',5.7],
['77.85', '为了山间轻流的小溪',5.8],
['83.97', '为了宽阔的草原',3.7],
['87.88', '流浪远方 流浪',14.2],
['102.77', '还有还有',3.7],
['106.62', '为了梦中的橄榄树橄榄树',7.7],
['114.72', '不要问我从那里来',6.0],
['121.00', '我的故乡在远方',9.3],
['130.77', '为什么流浪',3.6],
['134.57', '为什么流浪远方',10.2],
['145.31', '为了我梦中的橄榄树',10.9],
['156.79', 'LRC歌词制作 相约爱晚亭',13.9],
['171.37', '不要问我从那里来',5.6],
['177.22', '我的故乡在远方',5.7],
['183.17', '为什么流浪',5.3],
['188.77', '流浪远方 流浪',13.8],
['203.30', '为了天空飞翔的小鸟',5.2],
['208.74', '为了山间轻流的小溪',6.3],
['215.34', '为了宽阔的草原',4.8],
['220.38', '流浪远方 流浪',10.9],
['231.83', '谢谢光临欣赏',2.1],
['234.01', '',4.5]
];
(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()*10 + 300}px;
top: ${Math.random()*0 + 140}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>
<br><br><br><br><br></td></tr> 欣赏一下,谢谢。 蓝魔 发表于 2022-11-10 23:09
欣赏一下,谢谢。
谢谢蓝魔的关注和支持! 欣赏收藏老师的[夕阳下] 好看又好听,点赞! 欣赏楼主的新作,点赞多谢分享! 巫荣云师 发表于 2022-11-11 20:11
欣赏收藏老师的[夕阳下] 好看又好听,点赞!
谢谢您的支持和鼓励! 非常开心 发表于 2022-11-11 22:57
欣赏楼主的新作,点赞多谢分享!
谢谢您的支持和鼓励! 欣赏了谢谢 午老虎 发表于 2022-11-24 08:23
欣赏了谢谢
谢谢您的关注和支持! 欣赏了谢谢老师
页:
[1]