缘在风中--梦油(学习黑黑贝加尔湖畔效果)
<style>
#papa { margin: auto;left: -344px;width: 1280px; height: 750px;top: 150px;background: url('https://wj.zp68.com/lxx/yunhua/2022/09/23/G004IF.gif') no-repeat center/cover; box-shadow: 3px 3px 20px #000; box-shadow: 3px 3px 20px #000; display: flex; justify-content: center; overflow: hidden; position: relative; z-index: 1; }
#mplayer { position: absolute; bottom: 150px; left: 850px; width: 240px; 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, snow, darkgreen); opacity: 1; }
#btnwrap { fill: lightblue; cursor: pointer; }
#btnwrap:hover { fill: lightgreen; }
#btnwrap, #prog { position: absolute; display: grid; place-items: center; transition: .5s; }
#btnwrap { --yy: -15px; width: 40px; height: 40px; border-radius: 50%; border: 4px solid lightgreen; opacity: 0.1;}
#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: 240px; height: 16px; border-radius: 10px; background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,255,0) 100%, transparent 0); border: 1px solid lightgreen; font: normal 14px/16px sans-serif; color: snow; }
#lrc { position: absolute; top: 100px; left: 400px;font: bold 2.4em sans-serif; color: transparent; background: linear-gradient(-90deg, darkgreen, transparent) 0 0 / 200% 200%; filter: drop-shadow(2px 2px 40px #000); background-clip: text; -webkit-background-clip: text; text-stroke: 1px lightgreen; -webkit-text-stroke: 1px lightgreen; }
#dt{ position: absolute; width: 433px; height: 280px; top: -30px; left: 750px; }
#dt1{ position: absolute; width: 400px; height: 231px; top: 420px; left: 250px; }
#dt2{ position: absolute; width: 63px; height: 55px; top: 250px; left: 250px; }
#mpic {position: absolute; left: 0; top: 0; width: 60px;offset-distance: 0;offset-path: path("M0 40 Q500 180, 600 160 T1024 40");animation: move 8s 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="mpic" alt="" src="https://pic.imgdb.cn/item/6247e3c027f86abb2a56f17a.gif" />
<img id="dt" src="https://wj.zp68.com/lxx/yunhua/2022/09/23/6niao.gif" alt="" />
<img id="dt1" src="https://wj.zp68.com/lxx/yunhua/2022/09/23/az.gif" alt="" />
<img id="dt2" src="https://pic.imgdb.cn/item/6247e3c027f86abb2a56f17a.gif" alt="" />
<div id="lrc">花潮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 lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
let mKey = 0, mFlag = true, aud = new Audio();
prog.onclick = (e) => aud.currentTime = aud.duration * e.offsetX / prog.offsetWidth;
aud.src = 'https://wj.zp68.com/lxx/yunhua/2022/09/23/rzfz.mp3';
aud.autoplay = true;
aud.loop = true;
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {
prog.style.background= 'linear-gradient(90deg,rgba(0,0,0,.45), rgba(0,255,0) ' + aud.currentTime / aud.duration * 100 + '%, transparent 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;
if(mKey > lrcAr.length - 1) mKey = lrcAr.length - 1;
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>
<br><br><br><br><br><br><br><br><br><br> @马黑黑
我被这个rgba颜色搞糊了,问了度娘,不晓得这个颜色怎么样,感觉透明就好了{:4_170:} @梦油
谢谢梦油一直支持小辣椒,送一首缘在风中,感谢梦油的支持{:4_187:} 把大鹰加进去了{:4_189:} 谢谢黑黑的精彩分享,小辣椒套用都花了脑筋,黑黑太辛苦的,每天有分享{:4_178:} 黑神你太厉害了,佩服的不要不要的{:4_178:} 做这首歌的时候,歌词不熟,出来有不同步,等做玩了这个帖,结果已经可以哼哼的跟唱了{:4_170:} 制作漂亮。赞!{:4_199:} 这水的动态效果漂亮,还有划船的动图呢,亲爱的这个制作那么多动态效果,又好看又活泼。梦油收礼开心{:4_187:} 小辣椒 发表于 2022-9-23 21:31
@马黑黑
我被这个rgba颜色搞糊了,问了度娘,不晓得这个颜色怎么样,感觉透明就好了
rgba是 rgb + alpha通道。rgb,r = red(红),g = green(绿),b = blue(蓝),取值都是 0-255 之间,比如红色,rgb(255, 0, 0);然后加 a 通道值做透明设置,取值 0.0-1之间 马黑黑 发表于 2022-9-23 21:40
rgba是 rgb + alpha通道。rgb,r = red(红),g = green(绿),b = blue(蓝),取值都是 0-255 之间, ...
这个我问了度娘了,才用了现在的,感觉不晓得错误没有 小辣椒 发表于 2022-9-23 21:43
这个我问了度娘了,才用了现在的,感觉不晓得错误没有
我早讲过的,不用问度娘,度娘很啰嗦的{:4_170:} 马黑黑 发表于 2022-9-23 21:44
我早讲过的,不用问度娘,度娘很啰嗦的
问了我再蒙一下就出来这个效果了{:4_170:} 加林森 发表于 2022-9-23 21:37
制作漂亮。赞!
队长晚上好{:4_187:} 红影 发表于 2022-9-23 21:40
这水的动态效果漂亮,还有划船的动图呢,亲爱的这个制作那么多动态效果,又好看又活泼。梦油收礼开心{:4_18 ...
亲爱的,这个比较简单,我被这个rgba颜色搞糊涂了,{:4_189:}第一次碰到,以前没有学习教程的原因。不会了 马黑黑 发表于 2022-9-23 21:40
rgba是 rgb + alpha通道。rgb,r = red(红),g = green(绿),b = blue(蓝),取值都是 0-255 之间, ...
好在这个rgba通道我PS学习过一点道理,所以这次弄的还算快的,否则我还弄不好的,主要前面黑黑许多教程我都没有认真看的{:4_201:} 小辣椒 发表于 2022-9-23 21:53
好在这个rgba通道我PS学习过一点道理,所以这次弄的还算快的,否则我还弄不好的,主要前面黑黑许多教程我 ...
有空得补补 小辣椒 发表于 2022-9-23 21:46
问了我再蒙一下就出来这个效果了
你习惯了 小辣椒 发表于 2022-9-23 21:33
把大鹰加进去了
@加林森队长的鹰有猎物了{:4_170:}