Skip to content

Moiré Pattern

By the end of this lab you'll be able to:

  • Draw two overlapping sets of lines at slightly different angles
  • Understand how interference between two grids creates Moiré patterns
  • Control the Moiré pattern size by changing the angle difference

When two sets of nearly parallel lines overlap at a slight angle, they produce dramatic interference patterns — large-scale "beating" waves that seem to pulse across the canvas. This is the Moiré effect.

Welcome to Moiré Patterns!

Monty waving welcome Moiré patterns appear on TV screens when someone wears a checkered shirt — the screen's pixel grid interferes with the fabric's pattern! Let's code one ourselves!

How It Works

Draw two sets of evenly spaced parallel lines. Set one is horizontal; set two is rotated by a small angle (3°). Where lines from both sets cross, they reinforce; where they diverge, gaps form. The result is a large-scale wave pattern.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import turtle
import math
monty = turtle.Turtle()
monty.speed(0)
monty.hideturtle()

spacing = 8
n_lines = 40
length = 320

def draw_lines(angle_deg):
    monty.setheading(angle_deg + 90)
    perpendicular = math.radians(angle_deg)
    for i in range(-n_lines, n_lines):
        d = i * spacing
        cx = d * math.cos(perpendicular)
        cy = d * math.sin(perpendicular)
        start_angle = math.radians(angle_deg)
        monty.penup()
        monty.goto(cx - length/2 * math.cos(start_angle),
                   cy - length/2 * math.sin(start_angle))
        monty.pendown()
        monty.goto(cx + length/2 * math.cos(start_angle),
                   cy + length/2 * math.sin(start_angle))

monty.pencolor('navy')
monty.pensize(1)
draw_lines(0)

monty.pencolor('royalblue')
monty.pensize(1)
draw_lines(3)

What Do You Think Will Happen?

Monty thinking Two sets of lines, one rotated only 3° from the other. Will the slight angle difference be visible as separate lines, or as a beating pattern? Make your guess — then click Run to find out!

Try It Now


  

A large-scale beating pattern appears — bands of dense and sparse lines alternating across the canvas. Were you right?

How It Works

The Moiré period (the distance between "beats") is approximately spacing / sin(angle_difference). With spacing=8 and angle=3°, the beat period ≈ 8 / sin(3°) ≈ 153 pixels. That's why you see about 2 complete "fringes" across the canvas.

Explanation Table

Line What it does
spacing = 8 Distance between parallel lines
draw_lines(0) First set — horizontal lines
draw_lines(3) Second set — 3° rotation
math.cos(perpendicular) Position of line perpendicular to its direction

Learning Check

Your Turn — Change the Angle

Monty thinking Change draw_lines(3) to draw_lines(10). A larger angle means a smaller Moiré period — more beats per screen. Predict: how many bands will appear at 10°?


  

At 10°, the bands are narrower and more numerous — the Moiré period shrinks as the angle grows.

Experiments

  1. Use concentric circles. Replace the line sets with two sets of concentric circles with slightly different radii spacings. You'll know it worked when Moiré rings appear.

  2. Try 1° difference. Use draw_lines(0) and draw_lines(1). You'll know it worked when just 1–2 very wide bands appear (large period).

  3. Add a third set. Add draw_lines(6). You'll know it worked when a more complex interference pattern appears.

  4. Use dot grids instead of lines. Draw dots at a regular grid, then draw a second grid at 3° rotation. You'll know it worked when a hexagonal Moiré pattern appears.

Interference Patterns!

Monty celebrating You created a Moiré pattern — the same physics describes light interference, sound beats, and radio wave mixing. Geometry, optics, and physics in one picture! Up next: Bridget Riley Waves — undulating parallel curves.