套马杆
<div class="t_fsz"><style>
.bk1 {position:relative; left:0px; width:1000px; height:600px; margin:30px auto; box-shadow:0px 0px 20px 10px #008000; display: grid; place-items:center; overflow: hidden; z-index: 0; border:2px #cccccc solid;}
.bk2 {position:relative; left:0px; width: 996px; height:596px; margin: 0px auto; align-content:center; background: url('https://s1.ax1x.com/2021/12/09/oWhMvQ.gif') no-repeat center/cover; display: grid; place-items:center; overflow:hidden; z-index : 1; border:0px #cccccc solid;animation:aniAct0 20s infinite;}
@keyframes aniAct0{
0%{opacity:0.8;transform:scale(1.05);}
50%{opacity:1;transform:scale(1.5);}
100%{opacity:0.8;transform:scale(1.05);}}
.lm0 {position:relative; left:0px; width: 996px; height:596px; margin: 0px auto; align-content:center; background: url('https://pic1.imgdb.cn/item/6334366116f2c2beb14afe94.jpg') no-repeat center/cover; display: grid; place-items:center; overflow:hidden; z-index : 1; border:0px #cccccc solid;animation:aniAct0 6s infinite;}
#lrc { z-index:2;position: absolute; top:520px; font:bold 3.2em sans-serif; color:rgba(255,255,255,.99); text-shadow:1px 1px 1px #000; --motion: cover2; --tt: 1s; --state: running; }
#lrc::before { position:absolute; content:attr(data-lrc); width: 0; height: 100%; left: 0px; top: 0px; color: rgba(255,0,0,.9); overflow: hidden; white-space: nowrap; 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%; } }
#mpic {position: absolute; transform: rotateY(0deg); left: 0; top: 0; width: 120px; offset-distance: 0; offset-path: path("M 0 0 Q 300 150, 512 180 T 1024 110"); animation: move 8s linear infinite ;z-index : 10;}
@keyframes move { to { offset-distance: 100%; } }
#mpic1 {position: absolute; transform: rotateX(180deg); left: 0; top: 0; width: 100px; offset-distance: 0; offset-path: path("M 1024 100 Q 512 160, 300 100 T 0 0"); animation: move1 8s linear infinite ;z-index : 10;}
@keyframes move1 { to { offset-distance: 100%; } }
@keyframes bgMove1 { to { background-position: -100% 0; } }
@keyframes bgMove2 { to { background-position: -100% 0; } }
</style>
<div id="c3" class ="bk1">
<div id="c1" class ="bk2"></div>
<img id="mpic" alt="" src="https://pic.imgdb.cn/item/6330fcbb16f2c2beb143688d.gif" />
<img id="mpic1" alt="" src="https://pic.imgdb.cn/item/6330fcbb16f2c2beb143688d.gif" />
<div id="lrc" data-lrc=" "> </div>
<div id="mplayer">
<div id="btnwrap"><span id="btnplay"></span><span id="btnpause"></span></div>
<div id="prog">00:00 | 00:00</div>
</div>
</div>
<script>
let mKey = 0, mSeek = false, mFlag = true, aud = new Audio();
let lrcAr = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,];
aud.src = 'https://music.163.com/song/media/outer/url?id=1883829929.mp3';
aud.autoplay = true;
aud.loop = true;
btnwrap.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.style.background= 'linear-gradient(90deg, green, red ' + aud.currentTime / aud.duration * 100 + '%, snow 0)';
prog.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.display = 'block', btnpause.style.display = 'none', lrc.style.setProperty('--state', 'paused')) : (btnplay.style.display = 'none', btnpause.style.display = 'block', 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>
欣赏一下,谢谢。 欣赏收藏老师新作 好看又好听 全部照搬我的有什么意思?:lol 蓝魔 发表于 2022-11-24 23:46
欣赏一下,谢谢。
谢谢老师的欣赏和鼓励 非常开心 发表于 2022-11-25 20:01
欣赏收藏老师新作 好看又好听
谢谢老师的欣赏和鼓励 寒冬残荷 发表于 2022-11-25 20:21
全部照搬我的有什么意思?
老师 不会吧
页:
[1]