情歌对对唱--迟来的爱 (学习黑黑只爱自己效果)
<style>
#papa { margin: 120px 0 0 calc(50% - 721px); display: grid; place-items: center; width: 1280px; height: 699px; background: #000 url('https://pan.365.tf/uploads/lxx/20221112/bj.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; perspective: 1000px; overflow: hidden; user-select: none; position: relative; z-index: 1; }
#mplayer { position: absolute; top: 550px; right: 160px; z-index: 1000; }
#btnwrap { display: block; fill: hsla(30, 20%, 80%, .9); cursor: pointer; }
#btnwrap:hover { fill: hsla(90, 100%, 100%, .9); }
#tmsg { fill: hsla(30, 100%, 90%, .9); stroke: none; font: bold 1em sans-serif; }
#lrc { --motion: cover1; --tt: 1s; --state: running; position: absolute; top: 65px; left: 180px; font: bold 2.4em sans-serif; color: hsl(100,100%,90%); -webkit-background-clip: text; filter: drop-shadow(1px 1px 1px hsla(0,100%,0%,.85)); z-index: 900; }
#lrc::before { position: absolute; content: attr(data-lrc); width: 20%; height: 100%; color: transparent; overflow: hidden; white-space: nowrap; background: linear-gradient(180deg,hsla(120, 48%, 22%,.35),hsla(120, 28%, 42%,.65)); filter: inherit; -webkit-background-clip: text; animation: var(--motion) var(--tt) linear forwards; animation-play-state: var(--state); }
.heart { position: absolute; top: 90px; left: 410px; width: 100px; height: 100px; display: grid; place-items: center; font: normal 40px sans-serif; color: red; offset-path: path('m271.44526,175.38086c65.55493,-161.83822 322.4013,0 0,208.07771c-322.4013,-208.07771 -65.55493,-369.91593 0,-208.07771z'); offset-distance: 10%; }
#dt1{ position: absolute; width: 544px; height: 333px; top: -52px; left: 606px; }
#dt2{ position: absolute; width: 350px; height: 300px; top: 400px; left: 50px; }
@keyframes move { to { transform: rotate(0) translate3d(0, 0, 0); } }
@keyframes cover1 { from { width: 0; } to { width: 100%; } }
@keyframes cover2 { from { width: 0; } to { width: 100%; } }
</style>
<div id="papa">
<img id="dt1" src="https://pan.365.tf/uploads/lxx/20221112/6niao.gif" alt="" />
<img id="dt2" src="https://pan.365.tf/uploads/lxx/20221112/hc.gif" alt="" />
<svg id="mplayer" width="120" height="120">
<g id="mama" transform="rotate(-90, 60, 60)" style="cursor: pointer;">
<circle id="track" cx="60" cy="60" r="50" fill="none" stroke-width="10" stroke="hsla(100, 20%, 80%, .65)" />
<circle id="prog" cx="60" cy="60" r="50" fill="none" stroke-width="10" stroke="hsla(100,50%,50%,.55)" />
</g>
<g id="btnwrap">
<path id="btnplay" d="M 50 50,50 70,70, 60 z"></path>
<path id="btnpause" d="M 52 50,52 70,57 70,57 50,52 50 z M 60 50,60 70,65 70,65 50,60 50 z" style="display: none;"></path>
<path d="M 57 50,60 50,60 70,57 70 z" fill="transparent" />
</g>
<path id="curPath" d="M 20 70 Q 60 0 100 70" fill="none" stroke="none"/>
<path id="durPath" d="M 20 55 Q 60 110 100 55" fill="none" stroke="none"/>
<g id="tmsg">
<text x="34" y="0"><textPath id="curMsg" xlink:href="#curPath" dominant-baseline="text-after-edge">00:00</textPath></text>
<text x="29" y="0"><textPath id="durMsg" xlink:href="#durPath" dominant-baseline="text-before-edge">00:00</textPath></text>
</g>
</svg>
<div id="lrc" data-lrc="花潮论坛lrc在线">花潮论坛lrc在线</div>
</div>
<audio id="aud" src="https://pan.365.tf/uploads/lxx/20221112/clda.mp3" loop autoplay></audio>
<script>
(function() {(function() {let total = 40, ww = 80;Array.from({length: total}).forEach((item,key) => {item = document.createElement('span');item.className = 'heart';item.innerText = '\u2764';item.style.cssText += `color: #${Math.random().toString(16).substr(-6)};offset-distance: ${200/total*key}%;opacity: Math.random()*0.5 + 0.4;`;papa.appendChild(item);});})();
let mKey = 0, mFlag = true, cc = { x: 1*track.getAttribute('cx'), y: 1*track.getAttribute('cy'), len: track.getTotalLength(),};
let lrcAr = [
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
];
prog.style.strokeDasharray = prog.style.strokeDashoffset =cc.len;
btnwrap.onclick = () => aud.paused ? aud.play() : aud.pause();
mama.onclick = (e) => {let deg = Math.atan2(e.offsetY - cc.y, e.offsetX - cc.x) * 180 / Math.PI;deg += (e.offsetX < cc.x && e.offsetY < cc.y) ? 450 : 90;aud.currentTime = aud.duration * deg / 360;};
aud.addEventListener('pause', () => mState());
aud.addEventListener('play', () => mState());
aud.addEventListener('seeked', () => calcKey());
aud.addEventListener('timeupdate', () => {prog.style.strokeDashoffset = cc.len - cc.len * aud.currentTime / aud.duration;curMsg.textContent = toMin(aud.currentTime);durMsg.textContent = toMin(aud.duration);for (j = 0; j < lrcAr.length; j++) {if (aud.currentTime >= lrcAr) {if (mKey === j) showLrc(lrcAr);else continue;}}});
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 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 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> @马黑黑
谢谢分享教程,星星我还是用了彩色的{:4_173:} 加大了星星的尺寸,本来想100/total修改200的,星星重叠了。再改回星星宽和高100 一对小鲜肉,是曾经的小辣椒吗?{:4_199:} 闲言不语 发表于 2022-11-12 13:43
一对小鲜肉,是曾经的小辣椒吗?
是曾经的不语{:4_170:} 这歌听着很熟悉的感觉{:4_199:} 闲言不语 发表于 2022-11-12 13:45
这歌听着很熟悉的感觉
老歌,梦梦曾经经历过的,特别有感觉了{:4_170:} 小辣椒 发表于 2022-11-12 13:44
是曾经的不语
曾经的不语没有这么浪漫。 闲言不语 发表于 2022-11-12 13:47
曾经的不语没有这么浪漫。
怎么可能,看看你那些视频制作许多很浪漫的 小辣椒 发表于 2022-11-12 13:46
老歌,梦梦曾经经历过的,特别有感觉了
让俺想起了“文革”时期的手抄本《第二次握手》 闲言不语 发表于 2022-11-12 13:49
让俺想起了“文革”时期的手抄本《第二次握手》
梦梦还握手二次啊 小辣椒 发表于 2022-11-12 13:48
怎么可能,看看你那些视频制作许多很浪漫的
问一下你的长辈,我们那时主要的任务就是“抓革命,促生产。” 闲言不语 发表于 2022-11-12 13:51
问一下你的长辈,我们那时主要的任务就是“抓革命,促生产。”
谁说我不知道,我当然知道 抓革命,促生产 小辣椒 发表于 2022-11-12 13:49
梦梦还握手二次啊
说了你这小丫丫也不懂,那手抄本后来也公开发表了,当然,是文革结束后。 小辣椒 发表于 2022-11-12 13:53
谁说我不知道,我当然知道 抓革命,促生产
你那也是只停留在书本上的抓革命,促生产,并没经历过 闲言不语 发表于 2022-11-12 13:54
说了你这小丫丫也不懂,那手抄本后来也公开发表了,当然,是文革结束后。
反正我也是知道的{:4_189:} 闲言不语 发表于 2022-11-12 13:55
你那也是只停留在书本上的抓革命,促生产,并没经历过
抓革命,促生产 懂这个意思就可以了啊 小辣椒 发表于 2022-11-12 13:56
反正我也是知道的
好吧,俺假装你知道了{:4_397:} 闲言不语 发表于 2022-11-12 13:58
好吧,俺假装你知道了
这个我真知道的{:4_189:} 小辣椒 发表于 2022-11-12 13:28
@马黑黑
谢谢分享教程,星星我还是用了彩色的
就是随机变色的,每次打开,每个心可能都不一样的颜色