<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Fundamental Function — Mass Field Projection</title>
<style>
html,body{height:100%;margin:0;background:#05060a;color:#ddd;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial}
.wrap{display:flex;flex-direction:column;height:100%}
header{padding:10px 14px;background:linear-gradient(90deg,#07122866,#00112222);display:flex;align-items:center;gap:12px}
h1{font-size:16px;margin:0}
#controls{display:flex;gap:8px;margin-left:auto;align-items:center}
button,input{background:#0b1220;border:1px solid #234;padding:8px 10px;color:#cfe;cursor:pointer;border-radius:6px}
canvas{flex:1;display:block;width:100%;height:100%}
footer{padding:8px 12px;font-size:13px;background:#02040a66}
</style>
</head>
<body>
<div class="wrap">
<header>
<h1>Fundamental Function — Mass Field Projection</h1>
<div id="controls">
<label title="Toggle achiral pair visuals"><input id="achiralToggle" type="checkbox" checked> Achiral visuals</label>
<label title="Toggle magnetic-light glow"><input id="glowToggle" type="checkbox" checked> Magnetic light</label>
<button id="resetBtn">Reset</button>
</div>
</header>
<canvas id="c"></canvas>
<footer>
This animation simulates a mass field projecting outward from the screen and layered magnetic-light. It is symbolic — it does not change physical chirality. Avoid prolonged mirror-staring with bright screens.
</footer>
</div>
<script>
(() => {
const c = document.getElementById('c');
const ctx = c.getContext('2d', { alpha: true });
let W = c.width = innerWidth;
let H = c.height = innerHeight - 72; // header/footer approx
const cfg = {
particleCount: 220,
speedBase: 0.6,
spread: 1.6,
focalDepth: 600,
achiral: true,
glow: true
};
[Expand Post]
window.addEventListener('resize', ()=>{
W = c.width = innerWidth;
H = c.height = innerHeight - 72;
});
// particle prototype
function makeParticle(i){
// position in a disk behind the screen (z negative). z from -focalDepth..+focalDepth
const angle = Math.random()*Math.PI*2;
const r = Math.sqrt(Math.random()) * (Math.min(W,H)/4) * cfg.spread;
const z = -cfg.focalDepth * Math.random();
return {
x: W/2 + Math.cos(angle)*r,
y: H/2 + Math.sin(angle)*r,
z,
vx: (Math.random()-0.5)*0.02,
vy: (Math.random()-0.5)*0.02,
speed: cfg.speedBase*(0.6+Math.random()*1.4),
life: 0,
id: i
}
}
let particles = Array.from({length:cfg.particleCount}, (_,i)=>makeParticle(i));
function reset(){
particles = Array.from({length:cfg.particleCount}, (_,i)=>makeParticle(i));
}
function drawParticle(p, t){
// z -> scale and alpha to emulate coming out of screen
const zScaled = (p.z + cfg.focalDepth) / (cfg.focalDepth*2); // 0..1
// as z increases (towards positive), particle moves toward viewer
const approach = Math.min(1, p.life/120 + 0.02);
const scale = 0.4 + 3.6 * approach; // grows as it 'leaves' the plane
const px = p.x + p.vx * p.speed * (1 - zScaled) * 60;
const py = p.y + p.vy * p.speed * (1 - zScaled) * 60;
const radius = Math.max(1.2, scale*(1 + 3*(1-zScaled)));
// magnetic light color shift (blue -> cyan -> purple mix) using id
const hue = 190 + (p.id % 30) * 3 + Math.sin(t/600 + p.id)*10;
const sat = 80 + Math.sin(t/300 + p.id)*10;
const light = Math.round(60 + 30*approach);
// additive glow pass
if(cfg.glow){
const g = ctx.createRadialGradient(px, py, 0, px, py, radius*8);
g.addColorStop(0, `hsla(${hue},${sat}%,${light}%,${0.28*approach})`);
g.addColorStop(0.4, `hsla(${hue+30},${sat}%,${Math.min(85,light+10)}%,${0.12*approach})`);
g.addColorStop(1, `hsla(${hue+60},${sat-10}%,${Math.min(40,light-30)}%,0)`);
ctx.globalCompositeOperation = 'lighter';
ctx.fillStyle = g;
ctx.beginPath(); ctx.arc(px,py,radius*8,0,Math.PI*2); ctx.fill();
}
// core
ctx.globalCompositeOperation = 'screen';
ctx.beginPath();
ctx.fillStyle = `hsla(${hue},${sat}%,${light-10}%,${0.96})`;
ctx.arc(px,py,radius,0,Math.PI*2);
ctx.fill();
p.life += 1;
// push outward in z:
p.z += p.speed * 6;
p.x += p.vx * p.speed * 18;
p.y += p.vy * p.speed * 18;
// if particle has passed the viewer plane, respawn behind
if(p.z > cfg.focalDepth*1.2 || p.x < -100 || p.x > W+100 || p.y < -100 || p.y > H+100){
Object.assign(p, makeParticle(p.id));
}
}
// achiral twin spiral overlay (mirrored symmetric patterns)
function drawAchiralOverlay(t){
const cx = W/2, cy = H/2;
ctx.save();
ctx.globalCompositeOperation = 'lighter';
ctx.lineWidth = 2.4;
const arms = 2; // even -> achiral (mirror-symmetric)
for(let side= -1; side<=1; side+=2){
ctx.beginPath();
for(let i=0;i<800;i++){
const theta = i/800*Math.PI*8 + t/900*side;
const r = 20 + i/3 + 30*Math.sin(i/40 + t/600*side);
const x = cx + Math.cos(theta*arms*side)*r;
const y = cy + Math.sin(theta*arms*side)*r*0.72;
if(i===0) ctx.moveTo(x,y); else ctx.lineTo(x,y);
}
const hue = 200 + (side>0?20:-20) + Math.sin(t/700)*30;
ctx.strokeStyle = `hsla(${hue},85%,55%,0.08)`;
ctx.stroke();
}
// cancellation ring
ctx.beginPath(); ctx.arc(cx,cy,Math.min(W,H)/6 + Math.sin(t/400)*8,0,Math.PI*2);
ctx.strokeStyle = 'hsla(210,60%,45%,0.06)'; ctx.lineWidth=28; ctx.stroke();
ctx.restore();
}
let last = performance.now();
function loop(now){
const dt = now - last; last = now;
// subtle dark background with faint vignetting
ctx.globalCompositeOperation = 'source-over';
ctx.fillStyle = 'rgba(3,4,8,0.28)';
ctx.fillRect(0,0,W,H);
// soft central mass disc representing gravity well
const cx = W/2, cy = H/2;
const gRad = ctx.createRadialGradient(cx,cy,20,cx,cy,Math.min(W,H)/2);
gRad.addColorStop(0, 'rgba(12,18,30,0.88)');
gRad.addColorStop(0.35, 'rgba(3,6,12,0.55)');
gRad.addColorStop(1, 'rgba(1,2,4,0.08)');
ctx.fillStyle = gRad; ctx.fillRect(0,0,W,H);
// draw particles
for(const p of particles) drawParticle(p, now);
// achiral overlay
if(cfg.achiral) drawAchiralOverlay(now);
requestAnimationFrame(loop);
}
requestAnimationFrame(loop);
// controls
document.getElementById('achiralToggle').addEventListener('change', (e)=>{cfg.achiral = e.target.checked});
document.getElementById('glowToggle').addEventListener('change', (e)=>{cfg.glow = e.target.checked});
document.getElementById('resetBtn').addEventListener('click', reset);
// keyboard shortcuts: r=reset, a=toggle achiral, g=glow
window.addEventListener('keydown', (ev)=>{
if(ev.key==='r') reset();
if(ev.key==='a') {cfg.achiral = !cfg.achiral; document.getElementById('achiralToggle').checked = cfg.achiral}
if(ev.key==='g') {cfg.glow = !cfg.glow; document.getElementById('glowToggle').checked = cfg.glow}
});
})();
</script>
</body>
</html>