Click or drag to trigger expansion waves

Octopus-skin

Oscillators drift, synchronize, and modulate color by phase

 

Tech Stack: p5.js

sync-engine.js
// ⏳ 1. STEPPING THE TIMELINE FORWARD
// Every frame, each point steadily builds up its internal timer
p.phase += p.freq;

// ⚡ 2. THE FLASH & TRIGGER EVENT
// When a point reaches full charge, it resets and signals a flash
if (p.phase >= 1) {
  p.phase = 0;
  p.flash = 1;  // Instantly jump to max brightness

  // 🌐 3. SPREADING THE SIGNAL TO NEIGHBORS
  // Check all other points; if they are close enough, nudge them closer to flashing
  for (let q of points) {
    if (p === q) continue;
    let d = dist(p.x, p.y, q.x, q.y);
    
    if (d < couplingRadius) {
      q.phase += couplingStrength; // Give the neighbor a phase boost
      if (q.phase >= 1) q.phase = 0;
    }
  }
}

// 📉 4. THE GLOW FADE EFFECT
// Smoothly decay the brightness over time so it behaves like a pulse
p.flash *= 0.90;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share