《愿我如星君如月》纯音乐(套用老黑‘流星拖尾版’制作)
本帖最后由 加林森 于 2022-8-13 21:23 编辑 <br /><br /><style>#papa { left: -214px; width: 1024px; height: 640px; background: gray url('https://s1.ax1x.com/2022/08/12/vY8AAI.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; overflow: hidden; position: relative; }
#disc { position: absolute; width: 40px; height: 40px; left: 10px; bottom: 10px; background: conic-gradient(red,orange,yellow,green,teal,blue,purple); mask: radial-gradient(transparent 4px,red 0); -webkit-mask: radial-gradient(transparent 4px,red 0); border-radius: 50%; cursor: pointer; animation: rot 2s linear infinite; }
#lrcbox { position: absolute; left: 60px; bottom: 10px;font: bold 22px / 40px sans-serif; color: lightblue; text-shadow: 2px 2px 4px #222; }
#canv { position: absolute; width: 1024px; height: 350px; left: 0; top: 0; }
@keyframes rot { to { transform: rotate(360deg); } }
</style>
<div id="papa">
<span id="lrcbox">Loading ...</span>
<canvas id="canv" width="1024" height="350"></canvas>
<span id="disc"></span>
</div>
<script>
let ctx = canv.getContext('2d');
let w = canv.width, h = canv.height;
let num = (m, n) => Math.floor(Math.random() * (n - m + 1) + m);
let stars = new Array(400), meteors = new Array(10);
let aud = new Audio();
let lrcAr = [
['0.06','愿我如星君如月'],
['60.06','歌手 - 七结音'],
['120.06','所属专辑:愿我如星君如月'],
['140.06','谢谢欣赏'],
];
aud.loop = true;
aud.autoplay = true;
aud.src = 'https://music.163.com/song/media/outer/url?id=1438607152.mp3';
disc.style.animationPlayState = aud.paused ? 'paused' : 'running';
disc.onclick = () => aud.paused ? aud.play() : aud.pause();
aud.addEventListener('playing',()=> disc.style.animationPlayState = 'running');
aud.addEventListener('pause',()=> disc.style.animationPlayState = 'paused');
aud.addEventListener('timeupdate',function(){
let tt = aud.currentTime;
for(j=0; j<lrcAr.length; j++){
if(tt >= lrcAr) lrcbox.innerHTML = lrcAr;
}
});
function Star() {
this.x = num(3, w - 3);
this.y = num(3, h -3);
this.r = num(1,3) * .5;
this.a = num(1, 10) * 0.1;
this.speedA = 0.01;
this.color = 'rgba(153, 204, 255, .6)';
}
Star.prototype = {
create: function() {
ctx.beginPath();
ctx.fillStyle = this.color;
ctx.arc(this.x, this.y, this.r, 0, Math.PI * 2);
ctx.fill();
},
flash: function() {
this.a +=this.speedA;
if(this.a > 1 || this.a < 0) this.speedA = -this.speedA;
this.color = 'rgba(153, 204, 255, ' + this.a+ ')';
this.create();
},
drop: function() {
this.x += 2;
this.y += 2;
this.a = .45;
if(this.x > w - 3 || this.y > h - 3) {
this.x = num(3, w - 3);
this.y = num(3, h -3);
}
}
};
for(let x = 0; x < stars.length; x++) {
let star = new Star();
stars = star;
}
for(let x = 0; x < meteors.length; x ++) meteors = num(0,stars.length - 1);
(function render() {
ctx.globalCompositeOperation = 'destination-out';
ctx.fillStyle = 'rgba(0,0,0,.1)';
ctx.fillRect(0,0,w,h);
ctx.globalCompositeOperation = 'lighter';
for(let x of stars) x.flash();
for(let x of meteors) stars.drop();
requestAnimationFrame(render);
})();
</script>
@马黑黑 @小辣椒 队长手快。好制作。赞。 马黑黑 发表于 2022-8-12 20:59
队长手快。好制作。赞。
还行吗。 加林森 发表于 2022-8-12 21:02
还行吗。
很行 马黑黑 发表于 2022-8-12 21:02
很行
嗯嗯。谢谢啦!{:4_190:} 加林森 发表于 2022-8-12 21:04
嗯嗯。谢谢啦!
{:4_180:} 马黑黑 发表于 2022-8-12 21:04
{:4_191:} 再来欣赏!{:4_208:} 队长的制作真漂亮,流星拖尾很清晰的{:4_187:} 红影 发表于 2022-8-12 22:09
队长的制作真漂亮,流星拖尾很清晰的
是的。跟到学就要一样才好。只是图片不一样而已。 队长这个背景图颜色不够深,流星会看的不够清楚,特别这个流星尾巴 欣赏队长的精彩制作{:4_178:} 小辣椒 发表于 2022-8-13 12:30
队长这个背景图颜色不够深,流星会看的不够清楚,特别这个流星尾巴
才行去找个黑的图片上来试一试。 小辣椒 发表于 2022-8-13 12:37
欣赏队长的精彩制作
谢谢啦! 队长好快啊,这个制作漂亮 绿叶清舟 发表于 2022-8-13 19:17
队长好快啊,这个制作漂亮
谢谢清舟支持!{:4_190:} 加林森 发表于 2022-8-13 20:01
谢谢清舟支持!
队长客气了 绿叶清舟 发表于 2022-8-13 21:21
队长客气了
好的好的。
页:
[1]