HelioAI's picture
LFM3-1.7B inference modules: experimental release
67ebcef verified
Raw History Blame Contribute Delete
1.99 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Particle fountain</title>
<style>html,body{margin:0;height:100%;overflow:hidden;background:#05060d} canvas{display:block}</style>
</head>
<body>
<canvas id="c"></canvas>
<script>
const canvas = document.getElementById('c');
const ctx = canvas.getContext('2d');
let W, H;
function resize() { W = canvas.width = innerWidth; H = canvas.height = innerHeight; }
addEventListener('resize', resize);
resize();
const particles = [];
const GRAVITY = 520, MAX = 1600;
function spawn(n) {
for (let i = 0; i < n && particles.length < MAX; i++) {
const angle = -Math.PI / 2 + (Math.random() - 0.5) * 0.55;
const speed = 520 + Math.random() * 260;
particles.push({ x: W / 2 + (Math.random() - 0.5) * 8, y: H - 8,
vx: Math.cos(angle) * speed, vy: Math.sin(angle) * speed,
life: 0, ttl: 1.6 + Math.random() * 1.2, size: 1.5 + Math.random() * 2.5,
hue: 185 + Math.random() * 60 });
}
}
let last = performance.now();
function frame(now) {
const dt = Math.min(0.033, (now - last) / 1000);
last = now;
spawn(14);
ctx.globalCompositeOperation = 'source-over';
ctx.fillStyle = 'rgba(5,6,13,0.28)';
ctx.fillRect(0, 0, W, H);
ctx.globalCompositeOperation = 'lighter'; // additive glow
for (let i = particles.length - 1; i >= 0; i--) {
const p = particles[i];
p.life += dt;
if (p.life > p.ttl || p.y > H + 20) { particles.splice(i, 1); continue; }
p.vy += GRAVITY * dt;
p.x += p.vx * dt;
p.y += p.vy * dt;
const a = 1 - p.life / p.ttl;
const r = p.size * (2.5 + 2 * a);
const g = ctx.createRadialGradient(p.x, p.y, 0, p.x, p.y, r);
g.addColorStop(0, `hsla(${p.hue}, 100%, 75%, ${a})`);
g.addColorStop(1, `hsla(${p.hue}, 100%, 50%, 0)`);
ctx.fillStyle = g;
ctx.fillRect(p.x - r, p.y - r, r * 2, r * 2);
}
requestAnimationFrame(frame);
}
requestAnimationFrame(frame);
</script>
</body>
</html>