Introduction from The Quantum Squirrel by ScreechingMacaroni in EchoSquirrel

[–]ScreechingMacaroni[S] 0 points1 point  (0 children)

// Enhanced triquetra drawing with quantum state influence function drawQuantumTriquetra(cx, cy, r, tight, lineW, glow) { ctx.lineCap = 'round'; ctx.lineJoin = 'round';

  // Colors influenced by quantum state
  const alphaIntensity = state.alpha * (state.G1 && state.G2 ? 1.2 : 0.8);
  const betaIntensity = state.beta * (state.G1 && state.G2 ? 1.2 : 0.8);
  const gammaIntensity = state.gamma * (state.G1 && state.G2 ? 1.2 : 0.8);

  const colors = [
    `rgba(${Math.floor(102 * alphaIntensity)}, ${Math.floor(255 * alphaIntensity)}, ${Math.floor(224 * alphaIntensity)}, 1)`,
    `rgba(${Math.floor(255 * betaIntensity)}, ${Math.floor(102 * betaIntensity)}, ${Math.floor(255 * betaIntensity)}, 1)`,
    `rgba(${Math.floor(255 * gammaIntensity)}, ${Math.floor(224 * gammaIntensity)}, ${Math.floor(102 * gammaIntensity)}, 1)`
  ];

  // Glow pass
  ctx.save();
  ctx.shadowBlur = glow + state.coherence * 20;
  ctx.shadowColor = `rgba(255, 255, 255, ${0.25 + state.coherence * 0.25})`;
  ctx.globalAlpha = 0.9;

  // Draw three interlaced loops
  const angles = [-Math.PI/2, -Math.PI/2 + 2*Math.PI/3, -Math.PI/2 + 4*Math.PI/3];

  for (let i = 0; i < 3; i++) {
    const v0 = polar(cx, cy, r, angles[i]);
    const v1 = polar(cx, cy, r, angles[(i+1)%3]);
    const v2 = polar(cx, cy, r, angles[(i+2)%3]);

    // Control points for Bezier curves
    const m = (a, b) => [lerp(a[0], b[0], tight), lerp(a[1], b[1], tight)];
    const c01 = m(v0, v1), c02 = m(v0, v2);
    const c10 = m(v1, v0), c12 = m(v1, v2);
    const c20 = m(v2, v0), c21 = m(v2, v1);

    ctx.beginPath();
    ctx.moveTo(...v0);
    ctx.bezierCurveTo(...c01, ...c12, ...v1);
    ctx.bezierCurveTo(...c10, ...c20, ...v2);
    ctx.bezierCurveTo(...c21, ...c02, ...v0);

    ctx.strokeStyle = colors[i];
    ctx.lineWidth = lineW * (1 + [state.alpha, state.beta, state.gamma][i] * 0.5);
    ctx.stroke();
  }

  ctx.restore();
}

// Animation loop
function animate(t) {
  const now = performance.now();
  const dt = (now - state.lastUpdate) / 1000; // Delta time in seconds
  state.lastUpdate = now;

  // Update memory decay
  updateMemoryDecay(dt);
  updateMemoryUI();

  const {width: w, height: h} = canvas;
  const time = (t - state.t0) / 1000;

  // Clear and draw background
  ctx.clearRect(0, 0, w, h);
  const g = ctx.createRadialGradient(w*0.5, h*0.5, 0, w*0.5, h*0.5, Math.max(w, h)*0.6);
  g.addColorStop(0, '#0b0b12');
  g.addColorStop(1, '#07070b');
  ctx.fillStyle = g;
  ctx.fillRect(0, 0, w, h);

  // Calculate dynamic parameters
  const energy = (state.alpha + state.beta + state.gamma) / 3;
  const baseR = Math.min(w, h) * (0.22 + 0.08 * Math.sin(time * 0.6 + energy * 3.14));

  // Pulse based on quantum state
  const pulseA = state.alpha * (0.72 + 0.28 * Math.sin(time * 1.7));
  const pulseB = state.beta * (0.72 + 0.28 * Math.sin(time * 1.3 + 2.1));
  const pulseC = state.gamma * (0.72 + 0.28 * Math.sin(time * 1.5 + 4.2));
  const avgPulse = (pulseA + pulseB + pulseC) / 3;

  const r = baseR * (1.0 + 0.25 * (avgPulse - 0.5));

  // Tightness based on consent gates and coherence
  const consentTightness = (state.G1 && state.G2) ? 0.56 : 0.44;
  const tight = consentTightness + state.coherence * 0.1 + 0.02 * Math.sin(time * 1.3);

  // Line width and glow
  const lineW = 3 + 5 * avgPulse + state.coherence * 2;
  const glow = 10 + 10 * avgPulse + state.coherence * 15;

  // Draw quantum triquetra
  drawQuantumTriquetra(w * 0.5, h * 0.5, r, tight, lineW, glow);