Skip to content

Bridget Riley Waves

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

  • Draw a series of parallel sine wave curves with varying amplitude
  • Create a visual illusion of a rippling surface using only static lines
  • Control the wave shape with frequency and amplitude parameters

Inspired by Op Art painter Bridget Riley, this pattern draws rows of black undulating sine curves on a white background. The varying amplitude makes some parts of the canvas appear to bulge and recede.

Welcome to Bridget Riley Waves!

Monty waving welcome Bridget Riley is a British artist who creates patterns that seem to move. Her 1960s paintings use only black and white, yet they appear to vibrate! Let's code her wave patterns!

How It Works

Draw many horizontal sine curves at evenly spaced y positions. Each curve has the same x-frequency. The amplitude of each curve varies — largest in the center, tapering toward the edges. This creates the illusion of a bulging or rippling surface.

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
import turtle
import math
monty = turtle.Turtle()
monty.speed(0)
monty.hideturtle()

n_waves = 18
wave_width = 320
freq = 3
max_amp = 20
y_spacing = 16

monty.pensize(1)
monty.pencolor('black')

for row in range(n_waves):
    center_distance = abs(row - n_waves / 2) / (n_waves / 2)
    amp = max_amp * (1 - center_distance ** 2)
    y_base = (row - n_waves / 2) * y_spacing
    steps = 200
    monty.penup()
    for i in range(steps + 1):
        x = -wave_width / 2 + wave_width * i / steps
        y = y_base + amp * math.sin(freq * 2 * math.pi * i / steps)
        if i == 0:
            monty.goto(x, y)
            monty.pendown()
        else:
            monty.goto(x, y)
    monty.penup()

What Do You Think Will Happen?

Monty thinking The center rows have larger amplitude than the edge rows. Will this create a flat pattern, or will the center appear to bulge outward? Make your guess — then click Run to find out!

Try It Now


  

The center appears to bulge — the larger amplitude waves in the middle create the illusion of a 3D surface. Were you right?

How It Works

center_distance = abs(row - n_waves/2) / (n_waves/2) ranges from 0 (center) to 1 (edges). The amplitude max_amp * (1 - center_distance^2) follows a parabolic shape — maximum at center, tapering to near-zero at edges. This gradient creates the bulge illusion.

Explanation Table

Line What it does
center_distance How far this row is from center (0=center, 1=edge)
amp = max_amp * (1 - center_distance^2) Parabolic amplitude — large center, small edges
amp * math.sin(freq * 2 * pi * i / steps) Sine wave at this row's amplitude
freq = 3 Number of complete wave cycles per row

Learning Check

Your Turn — Try More Waves

Monty thinking Change n_waves = 18 to n_waves = 30 and freq = 5. More waves with higher frequency — will the illusion be stronger or different? Predict, then run it!


  

More waves and higher frequency creates a denser, more vibrating appearance — very much like Riley's original paintings.

Experiments

  1. Use a linear amplitude instead of parabolic. Change to amp = max_amp * (1 - center_distance). You'll know it worked when the amplitude tapers linearly rather than parabolically.

  2. Add phase shifts. Add + row * 0.2 to the sine argument. You'll know it worked when the waves shift diagonally instead of perfectly aligned.

  3. Vary the frequency. Use freq = 2 + row / 3 so inner rows have higher frequency. You'll know it worked when the wave frequency changes from row to row.

  4. Use two colors. Fill areas above the wave with black and below with white. You'll know it worked when alternating black and white bands appear.

Vibrating with Math!

Monty celebrating You coded Op Art inspired by Bridget Riley! These patterns were designed in the 1960s using ruler and compass — now you can code them. Up next: Expanding Hexagons — concentric hexagonal rings.