祖国有我--恭贺国庆
<style>
#papa { left: -250px; width: 1100px; height: 2000px; background: gray url('https://pic1.imgdb.cn/item/6336d58d16f2c2beb1a69a63.jpg') no-repeat center/cover; box-shadow: 3px 3px 20px #000; position: relative; }
#canv { position: absolute; }
#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: #fd330b; text-shadow: 1px 1px 2px #222; }
@keyframes rot { to { transform: rotate(360deg); } }
</style>
<div id="papa">
<span id="lrcbox">祖国有我</span>
<canvas id="canv"></canvas>
<span id="disc"></span>
</div>
<script>
(function() {
let num = (min, max) => Math.floor(Math.random() * (max-min+1)) + min;
let ctx = canv.getContext('2d');
let w = canv.width = papa.offsetWidth, h = canv.height = papa.offsetHeight, particles = [], idx = 0, aud = new Audio();
aud.src = 'http://music.163.com/song/media/outer/url?id=1893835610.mp3';
aud.loop = true;
aud.autoplay = true;
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');
canv.onclick = function(event) {
let x = event.offsetX || event.layerX, y = event.offsetY || event.layerY;
createParticle(x, y);
}
function createParticle(x, y) {
let count = 100, radius = 10;
for (let j = 0; j < count; j ++) {
let p = {};
let angle = 360 / count * j, radian = Math.PI / 180 * angle;
p.radius = radius;
p.startX = x;
p.startY = y;
p.radian = radian;
p.rgb = `${num(0,255)},${num(0,255)},${num(0,255)},`;
p.alpha = (Math.floor(Math.random() * 101)) / 100;
p.speed = (Math.random() * 5) + 0.4;
p.radius = p.speed;
particles.push(p);
}
}
function drawParticle() {
ctx.fillStyle = 'transparent';
ctx.fillRect(0, 0, w, h);
for (let j = 0; j < particles.length; j++) {
let p = particles;
let resultX = Math.cos(p.radian) * p.radius;
let resultY = Math.sin(p.radian) * p.radius + 0.4;
p.startX += resultX;
p.startY += resultY;
p.radius *= 1 - p.speed / 100;
p.alpha -= 0.005;
if (p.alpha <= 0) {
particles.splice(j, 1);
continue;
}
ctx.beginPath();
ctx.arc(p.startX, p.startY, .8, 0, 360, false);
ctx.closePath();
ctx.fillStyle = 'rgba(' + p.rgb + p.alpha + ')';
ctx.fill();
}
}
function fade() {
ctx.globalCompositeOperation = 'destination-out';
ctx.fillStyle = 'rgba(0, 0, 0, .1)';
ctx.fillRect(0, 0, w, h);
ctx.globalCompositeOperation = 'lighter';
}
function render() {
idx ++;
fade();
drawParticle();
if(idx > 20) {
createParticle(Math.random() * w, Math.random() * h/2);
idx = 0;
}
requestAnimationFrame(render);
}
render();
})();
</script>
清舟大制作,真棒!同祝福伟大的祖国繁荣昌盛,谱写豪峰新篇章!
国庆快乐清舟!
{:4_204:}{:4_199:}
好水平!好制作! 大猫咪 发表于 2022-9-30 20:15
清舟大制作,真棒!同祝福伟大的祖国繁荣昌盛,谱写豪峰新篇章!
国庆快乐清舟!
一起祝福祖国,猫节日快乐 闲言不语 发表于 2022-9-30 20:19
好水平!好制作!
今天马甲洗了吗{:4_189:} 烟花好美,舟舟,国庆快乐。{:4_204:}{:4_204:} 红芍药 发表于 2022-9-30 20:26
烟花好美,舟舟,国庆快乐。
芍药节日快乐{:4_204:} 醉美水芙蓉 发表于 2022-9-30 20:40
欣赏清舟精美大图!
谢谢芙蓉,节日快乐 大气又精致,欣赏清舟好帖,同祝大家国庆快乐{:4_187:} 清舟国庆节快乐~~~{:4_204:} 欣赏清舟的精彩制作{:4_199:} 红影 发表于 2022-9-30 20:54
大气又精致,欣赏清舟好帖,同祝大家国庆快乐
影节日快乐 小辣椒 发表于 2022-9-30 21:16
清舟国庆节快乐~~~
辣椒节日快乐 绿叶清舟 发表于 2022-9-30 21:46
影节日快乐
抱抱清舟,一起快乐{:4_179:} 红影 发表于 2022-9-30 21:59
抱抱清舟,一起快乐
{:4_179:}今年还不能到处乱跑的了 绿叶清舟 发表于 2022-10-1 19:26
今年还不能到处乱跑的了
是的,我今年也没出去,老老实实待着了。
页:
[1]