航天人之歌(学习黑黑彩色粒子效果)
<style>#papa {margin-left: -360px; display: grid; place-items: center; width: 1300px; height: 730px; top:150px;background: #000 url('https://wx.ttt.dj/updir/6365e8b74abc2.gif') no-repeat center/cover; box-shadow: 3px 3px 20px #000; perspective: 1000px; overflow: hidden; user-select: none; position: relative; z-index: 1; }
#papa::after { position: absolute; content: '航天人之歌'; top: 100px; font: bold 3em sans-serif; color:Cyan; text-shadow: 1px 1px 2px #fff; opacity: .6; }
#mplayer { position: absolute; bottom: 70px; left: 1080px;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; }
.stars { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: silver; transform-style: preserve-3d; }
#dt1{ position: absolute; width: 110px; height: 75px; top: 280px; left: 636px; }
#dt2{ position: absolute; width: 150px; height: 257px; top: 200px; left: 900px; }
@keyframes move { to { transform: rotate(0) translate3d(0, 0, 0); } }
</style>
<div id="papa">
<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(240, 20%, 80%, .77)" />
<circle id="prog" cx="60" cy="60" r="50" fill="none" stroke-width="10" stroke="hsla(240,100%,60%,.65)" />
</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></tex
</g>
</svg>
<img id="dt1" src="https://wj.zp68.com/lxx/yunhua/2022/10/10/hq.gif" alt="" />
<img id="dt2" src="https://wx.ttt.dj/updir/6365e8edc80f8.png" alt="" />
</div>
<audio id="aud" src="https://wj.zp68.com/lxx/yunhua/2022/10/10/htrzg.mp3" loop autoplay></audio>
<script>
(function() {
(function() {for(j=0; j<500; j++) {let ele = document.createElement('span');ele.className = 'stars';ele.style.cssText += `left: ${Math.random() * 200 + 420}px;top: ${Math.random() * 100 + 260}px;background: hsla(${Math.random() * 255}, ${Math.random() * 50 + 40}%,${Math.random() * 40 + 20}%, ${Math.random() * .5 + .4});box-shadow: 0 0 5px hsla(0,10%,100%,.25);transform: rotate(${Math.random() * 720}deg) translate3d(${Math.random() * 500}px,${Math.random() * 300}px,${Math.random() * 1000}px);animation: move 30s infinite ${-10 - Math.random() * 20}s linear;`;papa.appendChild(ele);}})();
let cc = { x: 1*track.getAttribute('cx'), y: 1*track.getAttribute('cy'), len: track.getTotalLength(),};
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', () => aud.play());
aud.addEventListener('timeupdate', () => {prog.style.strokeDashoffset = cc.len - cc.len * aud.currentTime / aud.duration;curMsg.textContent = toMin(aud.currentTime);durMsg.textContent = toMin(aud.duration);});
let mState = () => aud.paused ? (btnplay.style.display = 'block', btnpause.style.display = 'none') : (btnplay.style.display = 'none', btnpause.style.display = 'block');
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;};
document.title = 'Human Legacy';
})();
</script>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br> @马黑黑
黑黑都是现成的歌曲和图图,加了彩色粒子,画面灵动感增加了。。。。{:4_173:} 没有加歌词同步,可以秒做{:4_170:} 自己坐沙发,本来准备上来给你消灭0回复的{:4_170:} 本帖最后由 冬天的雨 于 2022-11-5 15:22 编辑
高科技的航天事业,我国已经攀登了一个又一个高峰,可贺可喜{:4_178:} 马老师的彩色粒子漂亮{:4_199:} 这2天休息就学习玩一个{:4_170:} 辣椒好快啊,这个效果漂亮 绿叶清舟 发表于 2022-11-5 15:10
辣椒好快啊,这个效果漂亮
清舟好,难得碰到你了{:4_187:} 浩瀚的太空飘扬着五星红旗太漂亮了,小辣椒朋友的设计真好! 冬天的雨 发表于 2022-11-5 15:21
清舟好,难得碰到你了
是啊,你现在忙啊 小辣椒音乐=爱国情怀。{:4_374:} 樵歌 发表于 2022-11-5 19:03
小辣椒音乐=爱国情怀。
樵哥哥晚上好{:4_187:} 小辣椒 发表于 2022-11-5 19:04
樵哥哥晚上好
小辣椒好{:4_185:} 小辣椒 发表于 2022-11-5 13:14
@马黑黑
黑黑都是现成的歌曲和图图,加了彩色粒子,画面灵动感增加了。。。。
是的,很配套的呢 黑黑老师的底图,配搭的元素挺好的{:4_187:} 千羽 发表于 2022-11-5 21:36
黑黑老师的底图,配搭的元素挺好的
不是黑黑的底图,这个是岁月的粒子我做的动图,彩色粒子是黑黑的 画面中正能量是满满哒{:4_187:} 马黑黑 发表于 2022-11-5 19:21
是的,很配套的呢
这种天空的动图我做过好几个,都可以配彩色粒子 樵歌 发表于 2022-11-5 19:13
小辣椒好
樵哥哥睡觉了吧