Visualizations
437 / 500

437 · Illusions

Waterfall Illusion

Stare for twenty seconds, then watch a frozen picture drift the other way.

A guided motion aftereffect: fixate the dot while a spiral turns, a checkerboard tunnel expands or a waterfall falls, and when the motion stops the still image visibly drifts backwards. Beside it runs a model of 16 direction-selective neurons (tuned to directions for the waterfall and to spiral space, like MST cells, for the spiral and tunnel), each with a gain that fatigues under drive and recovers over about nine seconds. Perceived motion is decoded as the population vector, so when the stimulus stops the fatigued cells answer the static texture less and the vector points backwards until they recover; a dashed forecast runs a copy of the model ahead over the whole trial, so the live trace can be checked against it. The patterns are per-pixel functions of m times the angle plus k times the log radius, with every pixel's phase and edge sharpness precomputed so each frame is one table lookup per pixel.

Try it. Keep your eyes on the red dot through the countdown. During the still phase, hold Space (or press and hold the picture) for as long as you still see drift to compare your aftereffect with the model's prediction. Pick Spiral, Tunnel or Waterfall (1 to 3), reverse the direction (R), set the adaptation time and speed, and press Space to restart.

  • Motion aftereffect
  • Neural adaptation model
  • Population vector decoding
  • Log-polar patterns

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a motion aftereffect demo (the waterfall illusion) with JavaScript and the HTML canvas element: watch a spinning spiral for twenty seconds, then it stops and the still image seems to drift the other way. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a square canvas that stays sharp on high-DPI screens (scale by devicePixelRatio).
- Render a spiral per pixel into a small offscreen canvas with ImageData, then drawImage it scaled up. For each pixel compute the angle theta and the log of the radius, and set brightness from sin(5 * theta + 10 * log(r) - phase).
- Increase phase every frame for the adaptation period so the spiral appears to expand, then stop changing it.
- Draw a small red dot in the center and a big countdown: "Stare at the dot: 20", then "Stopped. Keep staring."
- Repeat the cycle after a short pause.

Once that works, make it beautiful:
- Precompute each pixel's phase once into a Float32Array, so each frame is just a lookup and the loop stays fast.
- Sharpen the stripes without aliasing: scale the sine by r / sqrt(5 * 5 + 10 * 10) and clamp, so every edge is about one pixel wide.
- Color the stripes by radius, from warm in the middle to cold at the rim.
- Add a second stimulus: an expanding checkerboard tunnel (rings times spokes).

Explain the key ideas in short code comments, including why the aftereffect happens: neurons tuned to the adapted direction get tired, so when everything is still the opposite direction wins. When you're done, tell me how to open it and suggest three directions I could take it next, such as plotting a small model of adapting direction-selective neurons, adding a waterfall scene with static rocks, or letting me hold a key to measure how long my own aftereffect lasts.
PreviousSorting TapestrySix sorting algorithms cross-stitch a scrambled sampler back into a rainbow. NextDischarge TubesGlowing gas tubes whose colors are computed from their real spectral lines.

Related visualizations

  • Rotating SnakesIllusions A perfectly still image whose wheels turn wherever you are not looking.
  • AfterimageIllusions Stare at a surreal landscape, then see full color in a picture that is pure gray.
  • Lateral InhibitionIllusions Four brightness illusions, each predicted live by a model of retinal ganglion cells.
  • Geometric IllusionsIllusions Six classic illusions on graph paper, and a lab that measures how much they fool you.
  • Point-Light WalkerIllusions Thirteen dots on black, and you see a person walking, running, dancing or carrying a box.
  • Hidden 3DIllusions A live magic eye picture: a turning 3D sculpture hidden in colorful noise.
  • Aperture ProblemIllusions One grating, one true motion, three holes that each report a different direction.
  • StroboscopeIllusions Wheels stop, creep and spin backwards under a film camera or a strobe.
  • Video FeedbackGenerative art A virtual camera films its own monitor and grows spirals, tunnels and fractals.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs