七神之光(音乐欣赏)
本帖最后由 加林森 于 2022-9-2 19:52 编辑 <br /><br /><style>#papa { left: -214px; width: 1024px; height: 634px; background: gray url('https://pic.imgdb.cn/item/6311794b16f2c2beb1cd3143.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; overflow: hidden; user-select: none; position: relative; }
#lrc { position: absolute; left: 20px; top: 40px; font: bold 1.5em sans-serif; color:#FF4500; text-shadow: 1px 1px 2px #000; letter-spacing: 2px; }
#mplayer { position: absolute; left: 20px; top: 80px; width: fit-content; height: fit-content; display: flex; align-items: center; gap: 8px; }
#btnwrap { width: 28px; height: 28px; background: #FF7F50; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
#btnwrap:hover { background: #FF4500; }
#btnplay { width: 16px; height: 16px; background: gold; clip-path: polygon(0 0, 0% 100%, 100% 50%); }
#btnpause { width: 2px; height: 20px; border-style: solid; border-width: 0px 4px; border-color: transparent gold; display: none; }
#prog { width: 200px; height: 2px; background: #FF4500 linear-gradient(90deg,red,olive,red) no-repeat ; background-size: 1px 2px; position: relative; cursor: pointer; }
#prog::before { position: absolute; top: -5px; height: 12px; width: 200px; content: ''; }
#tmsg { left: 260px; bottom: 16px; color: #FF7F50; }
.ball { position: absolute; left: -10px; top: 0; width: 10px; height: 10px; border-radius: 50%; background: red; animation: move 40s var(--ss) linear infinite; }
#vid { position: absolute; width: 1024px; height: 694px; top: -55px; object-fit: cover; opacity: .25;}
@keyframes move {
0%, 100% { left: 0; top: 0; }
25% { left: calc(100% - 10px); top: 0; }
50% { left: calc(100% - 10px); top: calc(100% - 10px); }
75% { left: 0; top: calc(100% - 10px); }
}
</style>
<div id="papa">
<video id="vid" src="https://img.tukuppt.com/video_show/2418175/00/02/06/5b4ff3af1047d.mp4" muted="muted" autoplay="autoplay" loop="loop"></video>
<span id="lrc">lrc歌词</span>
<span id="mplayer">
<span id="btnwrap"><span id="btnplay"></span><span id="btnpause"></span></span>
<span id="prog"></span>
<span id="tmsg">00:00 | 00:00</span>
</span>
</div>
<script>
let lrcAr = [
['00.00','七神之光'],
['560.00','谢谢欣赏']
];
let aud = new Audio(), lw = prog.offsetWidth;
aud.src = 'https://music.163.com/song/media/outer/url?id=418550511.mp3';
aud.autoplay = true;
aud.loop = true;
Array.from({length: 60}).forEach((item,key) => {
item = document.createElement('span');
item.className = 'ball';
item.style.cssText = `--ss: ${key * 0.5}s; background: #${Math.random().toString(16).substr(-6)};`;
papa.appendChild(item);
});
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('playing', ()=> btnstate());
aud.addEventListener('pause', ()=> btnstate());
aud.addEventListener('timeupdate', () => {
prog.style.backgroundSize = lw * aud.currentTime / aud.duration + 'px 2px';
tmsg.innerText = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);
for(j = 0; j < lrcAr.length;j ++) {
if(aud.currentTime >= lrcAr) lrc.innerText = lrcAr;
}
});
let btnstate = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none') : (btnplay.style.display = 'none', btnpause.style.display = 'block');
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>
@马黑黑 欣赏佳作,问候队长。 欣赏队长的精美作品 加了一个视频背景。 马黑黑 发表于 2022-9-2 12:30
欣赏队长的精美作品
老黑你再来看看,我根据你的提示,我修改了视频背景。两条阴阳鱼在转动。 这个视频和图片很相配,漂亮。{:4_187:} 貌似图片下方的视频又却了一块。 红影 发表于 2022-9-2 14:07
这个视频和图片很相配,漂亮。
是的。 红影 发表于 2022-9-2 14:07
貌似图片下方的视频又却了一块。
我还在调整。 加林森 发表于 2022-9-2 14:08
我还在调整。
现在好多了,还缺一点点。 红影 发表于 2022-9-2 15:20
现在好多了,还缺一点点。
现在不缺了。看的时间有点长,有两次变化的。 这个做得好,欣赏问好老师!{:4_204:} 梦缘 发表于 2022-9-2 16:29
这个做得好,欣赏问好老师!
谢谢梦缘!{:4_190:} @小辣椒 加林森 发表于 2022-9-2 15:25
现在不缺了。看的时间有点长,有两次变化的。
底下缺一条。 红影 发表于 2022-9-2 19:30
底下缺一条。
你再看看。 队长你是越来越厉害了{:4_178:} 视频做背景我玩的最少,要好好向队长学习了{:4_187:} 小辣椒 发表于 2022-9-2 21:00
队长你是越来越厉害了
这个也是自己创作的。
页:
[1]
2