C_W

Out to Sea

A break timer that fills the screen with a painted sea under your own sky. How it got its clouds, its rain and a frame time I could live with.

Topic
Experiments
Reading
3 min

Out to Sea has the same origin as working with agents by ear: after eye surgery I couldn’t look at a screen for long. Every twenty minutes a widget in my menu bar told me to look away, with a sound I didn’t like. So I replaced it. Out to Sea fills the screen with a painted sea for twenty seconds, and if I want to stay, it breathes with me.

It runs as a Mac menu bar app and, from the same code, in a browser at sea.cwdx.md.

The sky outside

The sea is drawn for where you are and when. Sunrise, sunset and the moon’s phase come from the clock. Cloud, rain, snow, fog, wind and temperature come from Open-Meteo. You can also keep a sky of your own: time of day, weather and temperature are three separate choices, and they mix.

Tap the water and a stone goes in. The rings follow the rule real ones do. Long waves travel fastest, so the rings are widest at the front and finer toward the middle, where the water has already gone calm.

What made it work

I started from four mock-ups and built it with a coding agent, by looking at the result and saying what was wrong. A lot was wrong.

  • Clouds. The first were rectangles and the second looked like a child had drawn them. Proper ones, a volume the view marches through with light and shadow, cost about 25 milliseconds a frame against 4 for the painted sky before them, and the tab struggled. The fix came from an example that ships with vgpu, the WebGPU library underneath: bake the cloud noise once into a 3D texture, then march it at half size in its own pass. Every sky now draws in 5 to 9 milliseconds.
  • Rain. For an evening it fell from above the clouds, stopped short of the water, or was wider than the cloud it came from. Each patch fixed one case. What fixed all of them was to stop drawing rain and model where it is: the air under cloud thick enough to let go of it. A far shower became a shaft hanging from its cloud, and rings land on the sea only where it rains.
  • Temperature. My first try tinted the whole picture warmer or colder, which was ugly. Now heat is haze: a milky horizon by day, a redder sunset, a wide glare around the sun. Cold is a deeper blue overhead and sharper stars. Under rain neither shows much, as outside.
Diagram
flowchart LR
  N[cloud noise, baked once] --> C[clouds, half size]
  N --> R[rain and snow, half size]
  C --> S[sky, sea and words]
  R --> S

The painting stays flat on purpose. The sea is a real swell the view is traced onto, then shaded in three tones, with the light on the water laid on as strokes.

What it gets wrong

It needs WebGPU, and there is no fallback. The sound is synthesised, and after I called it too loud more than once the rain became a soft hush instead of drops, which is calmer and less like rain. In a browser the reminder only works while the tab stays open. A distant shower’s shaft is still too faint.

Open questions

  • Does a sea that matches the weather outside help you look away, or is any horizon enough?
  • How much of this should stay when the system asks for reduced motion?