古老的歌谣
本帖最后由 绿叶清舟 于 2022-9-19 20:32 编辑 <br /><br /><style>#papa { left: -250px; width: 1100px; height: 700px; background: #ccc url('https://pic.imgdb.cn/item/6327c08316f2c2beb1193fe8.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; display: grid; place-items: center; overflow: hidden; position: relative; z-index: 1; }
#mplayer { position: absolute; bottom: 0; width: 300px; height: 80px; user-select: none; display: grid; place-items: center; cursor: pointer; }
#mplayer:hover #btnwrap, #mplayer:hover #prog { transform: translateY(var(--yy)); }
#mplayer:hover #btnwrap { background: linear-gradient(to top right, red, green); border-radius: 50%; opacity: .75; }
#btnwrap, #prog { position: absolute; display: grid; place-items: center;transition: .5s; }
#btnwrap { --yy: -15px; width: 40px; height: 40px; transform: rotate(45deg); border: 1px solid tan; border-radius: 6px; opacity: .25; }
#btnplay { width: 20px; height: 20px; background: #eee; clip-path: polygon(0 0, 0% 100%, 100% 50%); }
#btnpause { width: 2px; height: 20px; border-style: solid; border-width: 0px 4px; border-color: transparent #eee; display: none; }
#prog { --yy: 20px; width: 300px; height: 16px; border-radius: 10px; background: linear-gradient(90deg, #9dc320, #c7e81f 100%, transparent 0); border: 1px solid gray; font: normal 14px / 16px sans-serif; color: #b3e102; opacity: .75; }
#plane {position: absolute;left: 30px;top: 0;width: 280px;offset-distance: 0;offset-path: path("M0 20 A80 40 0 1 1 290 100 A80 40 0 0 1 10 100z Q300 80, 600 200T1000 100");animation: move 18s linear infinite;}
@keyframes bgMove1 { from { background-position: 0 0; } to { background-position: -100% 0; } }
@keyframes bgMove2 { from { background-position: 0 0; } to { background-position: -100% 0; } }
@keyframes move { to { offset-distance: 100%;} }
</style>
<div id="papa">
<img id="plane" src="https://pic.imgdb.cn/item/6327c24e16f2c2beb11a88fe.gif" alt="" />
<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 lrcAr = [
];
let mKey = 0, mFlag = true;
let aud = new Audio();
aud.src = 'http://music.163.com/song/media/outer/url?id=29539348.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, #9dc320, #c7e81f ' + 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.animationPlayState = 'paused') : (btnplay.style.display = 'none', btnpause.style.display = 'block', lrc.style.animationPlayState = 'running');
let showLrc = (time) => {
lrc.style.animation = (mFlag ? 'bgMove1 ' : 'bgMove2 ') + time + 's linear forwards';
lrc.innerHTML = lrcAr;
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;
let mtime = lrcAr - (aud.currentTime - lrcAr);
showLrc(mtime);
}
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_173:}
这个路径下的动图设计很神奇,竟然能累积剩余的量,而导致起始点不断在路径上前移呢。很奇特。 清舟的制作,配色总是那么漂亮,这个制作里的色彩太美了{:4_199:} 红影 发表于 2022-9-19 10:57
清舟的制作,配色总是那么漂亮,这个制作里的色彩太美了
这个简单二张图就搞定了{:4_189:} 醉美水芙蓉 发表于 2022-9-19 11:40
欣赏清舟美女大作品!
谢谢芙蓉支持了 绿叶清舟 发表于 2022-9-19 16:24
这个简单二张图就搞定了
还是很漂亮的{:4_187:} 红影 发表于 2022-9-19 20:53
还是很漂亮的
是啊,发现简单的一样可以,这样就有偷懒的理由了{:4_189:} 绿叶清舟 发表于 2022-9-21 20:27
是啊,发现简单的一样可以,这样就有偷懒的理由了
这种简单的做法,我没本事弄出来,就羡慕着吧。{:4_173:} 红影 发表于 2022-9-21 21:04
这种简单的做法,我没本事弄出来,就羡慕着吧。
刚去看了网上版的美图秀秀里面有滤镜功能,就不知道效果是怎样的了 绿叶清舟 发表于 2022-9-21 21:33
刚去看了网上版的美图秀秀里面有滤镜功能,就不知道效果是怎样的了
网络版的有好多和以前的不一样,我现在用的是最早的版本,比较习惯这个{:4_173:} 红影 发表于 2022-9-22 10:02
网络版的有好多和以前的不一样,我现在用的是最早的版本,比较习惯这个
以前的好,升级后看上去好象智能了,但自主性也更少了 绿叶清舟 发表于 2022-9-22 19:40
以前的好,升级后看上去好象智能了,但自主性也更少了
是啊,新版的更商业化了。
页:
[1]