姐妹花
本帖最后由 有声有色 于 2025-9-6 11:37 编辑 <br /><br /><style>#papa { left:-214px; width: 1024px; height: 640px; background: url('https://pic1.imgdb.cn/item/66dbfe8ed9c307b7e9b5326f.gif') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; display: grid; place-items: center; user-select: none; z-index: 1; --opt: .25;}
#papa::before { position: absolute; content: ''; width: 100%; height: 100%; background: url('') repeat; opacity: var(--opt); }
#mplayer { position: absolute; bottom: 0; z-index: 9; }
#lrc { --motion: cover1; --tt: 5s; --state: paused; position: absolute; top: 500px; font: bold 2.4em sans-serif; color: hsl(0,10%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 2px hsla(0,0%,0%,.95)); }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(180deg,hsla(280,100%,50%,.75),hsla(180,100%,50%,.75)); filter: inherit; -webkit-background-clip: text; 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%; } }
</style>
<div id="papa">
<div id="lrc" data-lrc="花潮lrc在线">花潮lrc在线</div>
<svg id="mplayer" width="360" height="60" style="user-select: none;">
<rect x="50" y="25" rx="6" ry="6" width="200" height="12" stroke="hsla(280,90%,55%,.45)" fill="hsla(60,100%,92%,.35)" id="track" />
<rect x="50" y="25" rx="6" ry="6" width="0" height="12" stroke="transparnet" fill="hsla(280,90%,55%,.45)" id="prog" />
<text x="260" y="31" font-size="14" dominant-baseline="middle" stroke="none" fill="tan" id="audtime">00:00 | 00:00</text>
<text x="10" y="35" font-size="40" dominant-baseline="middle" stroke="tan" fill="purple" id="btnplay" style="cursor: pointer;">☀
<animateTransform attributeName="transform" dur="4s" type="rotate" from="0 26.86 30" to="360 26.86 30" repeatCount="indefinite" />
</text>
</svg>
</div>
<script>
(function() {
let mp = { len: track.getAttribute('width')*1, x: track.getAttribute('x')*1 }, aud = new Audio(), mKey = 0, mFlag = true;
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
aud.src = 'https://link.hhtjim.com/163/30251870.mp3';
aud.loop = true;
aud.autoplay = true;
if(aud.paused) mplayer.pauseAnimations();
btnplay.onclick = () => aud.paused ? aud.play() : aud.pause();
prog.onclick = track.onclick = (e) => aud.currentTime = aud.duration * (e.offsetX - mp.x) / mp.len;
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('pause', () =>mState());
aud.addEventListener('play', () =>mState());
aud.addEventListener('timeupdate', () => {prog.style.setProperty('width', aud.currentTime * 200 / aud.duration + 'px');audtime.textContent = toMin(aud.currentTime) + ' | ' + toMin(aud.duration);for(j=0; j<lrcAr.length; j++) {if(aud.currentTime >= lrcAr) {cKey = j;if(mKey === j) showLrc(lrcAr);else continue;}}});
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 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 mState = () => aud.paused ? (mplayer.pauseAnimations(),lrc.style.setProperty('--state', 'paused'),papa.style.setProperty('--opt','0')) : (mplayer.unpauseAnimations(), lrc.style.setProperty('--state', 'running'),papa.style.setProperty('--opt','.25'));
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_199:}
动画制作的姐妹花图图漂亮{:4_199:} 小辣椒 发表于 2022-10-23 12:46
问好有声有色,背景和歌曲相配,制作精美
动画制作的姐妹花图图漂亮
谢谢一直在鼓励 色彩与图案搭配得当,棒棒哒 马黑黑 发表于 2022-10-23 15:31
色彩与图案搭配得当,棒棒哒
谢谢 本来是白天看到有路灯,就调整了一下 有声有色 发表于 2022-10-23 16:18
谢谢 本来是白天看到有路灯,就调整了一下
现在很多地方白天也开路灯的,咱们能源吃紧但绝对不缺{:4_173:} 路灯的动图特别漂亮。欣赏有声有色好帖{:4_199:} 马黑黑 发表于 2022-10-23 16:42
现在很多地方白天也开路灯的,咱们能源吃紧但绝对不缺
谢谢,你说的很对我家小区里的路灯大白天还亮着 醉美水芙蓉 发表于 2022-10-23 19:50
老师动画制作漂亮!
谢谢醉美老师鼓励 红影 发表于 2022-10-23 23:34
路灯的动图特别漂亮。欣赏有声有色好帖
那么晚还没睡啊,我早就到苏州了 哈哈 有声有色 发表于 2022-10-24 07:57
谢谢,你说的很对我家小区里的路灯大白天还亮着
嗯嗯,俺们不缺电{:4_170:} 有声有色 发表于 2022-10-24 07:59
那么晚还没睡啊,我早就到苏州了 哈哈
前面几天有事忙了,昨天回来就把拉下的帖子都赶紧欣赏了一遍{:4_173:}
页:
[1]