228

Moiré Interference

Visual optical interference fringes formed by the spatial overlap of two dense concentric circle grids shifting across phase space.

Playground
60 FPS Canvas 2D
Click + Drag to interact with field
</>

Full Executable Algorithm Code

// 015 - Moiré Interference (geometry)
// 1:1 Original algorithm engine source
function createMoireInterference() {
  return {
    setup() {
    },
    render(context, timeState, params) {
      const { ctx, width, height } = context;
      const t = timeState.time * Number(params.speed || 0.5);
      const ringCount = Number(params.ringCount || 75);
      const separation = Number(params.separation || 40) + Math.sin(t * 0.8) * 30;
      ctx.fillStyle = "#08090d";
      ctx.fillRect(0, 0, width, height);
      const cx = width * 0.5;
      const cy = height * 0.5;
      const c1x = cx - separation;
      const c1y = cy;
      const c2x = cx + separation * Math.cos(t * 0.5);
      const c2y = cy + separation * Math.sin(t * 0.5);
      const maxR = Math.max(width, height) * 0.75;
      const step = maxR / ringCount;
      ctx.lineWidth = 1.3;
      for (let r = 5; r < maxR; r += step) {
        ctx.beginPath();
        ctx.arc(c1x, c1y, r, 0, Math.PI * 2);
        ctx.strokeStyle = hsla((180 + r / maxR * 60) % 360, 85, 60, 0.6);
        ctx.stroke();
      }
      for (let r = 5; r < maxR; r += step) {
        ctx.beginPath();
        ctx.arc(c2x, c2y, r, 0, Math.PI * 2);
        ctx.strokeStyle = hsla((280 + r / maxR * 60) % 360, 85, 65, 0.6);
        ctx.stroke();
      }
    }
  };
}

// Default parameters from content metadata
const defaultParams = [
  {
    "key": "ringCount",
    "label": "Ring Density",
    "type": "range",
    "min": 30,
    "max": 120,
    "step": 5,
    "defaultValue": 75,
    "description": "Concentric circle count"
  },
  {
    "key": "speed",
    "label": "Orbital Shift Speed",
    "type": "range",
    "min": 0.1,
    "max": 2,
    "step": 0.1,
    "defaultValue": 0.5,
    "description": "Phase drift speed"
  }
];

if (!window.__art_instances) window.__art_instances = {};
if (!window.__art_instances['moire-interference']) {
  const inst = typeof createMoireInterference === 'function' ? createMoireInterference() : null;
  if (inst && inst.setup) {
    inst.setup({ ctx, width, height, dpr: 1, aspectRatio: width / height }, defaultParams);
  }
  window.__art_instances['moire-interference'] = inst;
}

const instance = window.__art_instances['moire-interference'];
if (instance && instance.render) {
  instance.render(
    { ctx, width, height, dpr: 1, aspectRatio: width / height },
    { time, deltaTime: dt, frameCount: Math.floor(time * 60), fps: 60 },
    defaultParams
  );
}
Edit in Interactive Playground Zero Dependencies • Standalone Canvas 2D
ƒ

Mathematical Formulation

low
Analytical Equation
I(x,y)=cos(k1rc1)+cos(k2rc2(t))I(x, y) = \cos(k_1 \|\mathbf{r} - \mathbf{c}_1\|) + \cos(k_2 \|\mathbf{r} - \mathbf{c}_2(t)\|)
Click to expand
Compact Formula
fringe = arc(c1, r) + arc(c2(t), r), beat_frequency = |k1 - k2|

Mathematical Tags

#moire #interference #optical #grating #geometry #physics
Author: Math Art Core Target: 60 FPS

Export & Embed: Moiré Interference

4K PNG Snapshot

High-resolution single frame render

WebM Video (5s Loop)

60 FPS browser-captured stream

Standalone JS Script

Complete executable Canvas 2D algorithm

HTML Iframe Embed

<iframe src="https://art.fazleyrabbi.xyz/embed/moire-interference" width="500" height="500" frameborder="0" loading="lazy"></iframe>
ESC
↑↓ Navigate Select
110 Mathematical Artworks
Made by Fazley Rabbi

Support the Project

Keep mathematical creative coding alive & open source

Or via Direct Payoneer ($0 Fee)
Payoneer Customer ID: $0 Fee Direct
24076084

💡 Payoneer app: Go to Pay → Pay to recipient → Enter ID 24076084.

Thank you for supporting generative mathematical animations! ✨