Steer the weather on a Nakaya diagram and grow one-of-a-kind snowflakes.
Ice grows on a hexagonal lattice with the Gravner-Griffeath model of snow crystal growth: vapor diffuses toward the crystal, boundary sites collect a quasi-liquid layer, and a site freezes on when that layer beats a threshold that depends on how many ice neighbors it has, so tips, facets and kinks attach at different rates. Temperature and humidity on the Nakaya diagram set the vapor density and the tip threshold, so the same seed becomes a hexagonal plate, a sectored plate or a fernlike dendrite, and changing the weather mid-growth writes its history into the flake as branches within branches. Only one 60 degree sector is simulated and mirrored, which keeps the flake exactly six-fold. The frozen crystal mass is rendered as ice thickness: its gradient refracts the wool behind it with a little dispersion, catches glints from a movable light, and brightens ridges and edges like a macro photograph.
Try it. Drag on the Nakaya diagram (or use the arrow keys) to change temperature and humidity while the crystal grows. Drag on the photo to swing the light around, press 1 to 6 for scripted weather histories, and Space for a new crystal. Finished flakes collect in a row of thumbnails.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Grow snowflakes with JavaScript and the HTML canvas element, using a simple version of the Reiter model of snow crystal growth. 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 canvas that fills the window, stays sharp on high-DPI screens (scale by devicePixelRatio), and resizes with the window. Paint it a deep navy.
- Use a hexagonal grid of about 200 by 200 cells in axial coordinates, so every cell has six neighbors. Each cell holds a water value s. Start every cell at a background level beta (try 0.4) and set the center cell to 1.
- A cell is receptive if it is frozen (s >= 1) or touches a frozen cell. Each step, split s into a receptive part u (receptive cells keep their value, plus a constant gamma such as 0.001) and a mobile part v (everything else). Diffuse v by replacing it with the average of itself and its six neighbors with weight alpha (try 1), then add u back.
- Run a few dozen steps per frame and draw each frozen cell as a small hexagon, brighter where s is larger.
Once that works, make it beautiful:
- Map s inside the crystal to a pale blue-white ramp with a soft glow, so ridges where ice piled up read as thickness.
- Add sliders for alpha, beta and gamma, and show how small changes flip the crystal between plates, stars and fernlike dendrites.
- Simulate only one twelfth of the hexagon and mirror it, so the flake is perfectly symmetric and four times faster.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as the Gravner-Griffeath model with a quasi-liquid layer, a Nakaya diagram that maps temperature and humidity to the parameters, or refraction-style shading that makes the ice look like a macro photograph.