Ripple Waves¶
By the end of this lab you'll be able to:
- Draw concentric ellipses to simulate water ripples from multiple drop points
- Use fading colors to give a sense of wave strength decreasing with distance
- Combine multiple ripple sources that overlap and create interference patterns
Three concentric ring systems centered at different points — like three pebbles dropped into water. Where rings overlap, they create subtle interference patterns.
Welcome to Ripple Waves!
Drop a pebble in still water and watch the rings expand outward.
Drop three pebbles and see the rings interfere with each other!
Let's code the wave math together!
How It Works¶
ripple(cx, cy, n_rings, max_r, color) draws n_rings concentric circles from a center. Pensize decreases with each ring (outer rings are thinner — less energy). Three ripple centers are placed at different positions.
Sample Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
What Do You Think Will Happen?
Three ripple centers at different positions — will their rings overlap or stay separate?
Make your guess — then click Run to find out!
Try It Now¶
The rings overlap where the ripple systems meet — creating a visual interference pattern at their boundaries. Were you right?
How It Works¶
goto(cx, cy - r) moves to the bottom of each circle before drawing it. circle(r) draws the full circle. Thicker pensize for inner rings simulates more wave energy near the source.
Explanation Table¶
| Line | What it does |
|---|---|
r = i * max_r / n_rings |
Ring radii evenly spaced from center to max |
strength = n_rings - i + 1 |
Inner rings are stronger (higher number) |
pensize(max(1, strength//3)) |
Thicker lines for inner, stronger rings |
goto(cx, cy - r) |
Position turtle at bottom of circle |
Learning Check¶
Your Turn — Add a Fourth Ripple
Add a fourth ripple() call at a position of your choice with 'navy' color.
Where will it overlap most with the existing rings?
Four overlapping ripple systems — more interference regions where the rings cross.
Experiments¶
-
Change ring spacing. Replace evenly spaced rings with
r = max_r * (i / n_rings) ** 2— squared spacing means rings bunch up near the center. You'll know it worked when inner rings are denser. -
Animate the ripple. Draw rings in reverse order (outermost first) to create an animation effect. You'll know it worked when the rings appear to expand outward.
-
Use colored rings. Give each ring a slightly different shade — inner rings darker, outer lighter. You'll know it worked when there's a gradient from center to edge.
-
One giant ripple. Call
ripple(0, 0, 15, 170, 'teal')once. You'll know it worked when 15 rings fill nearly the entire canvas.
Making Waves!
You simulated water ripples with concentric circles and pensize fading!
The same math models sound waves, light waves, and even radio transmission patterns.
Up next: Category 7 — Mathematical Curves!