A heat map and minimap of selections

An article drawn by a canvas and coloured by how often each part has been selected. It starts with the selections of 40 simulated readers. Every selection you make is added after you stop changing it. The column at the right is the whole article drawn small with the same colours: drag in it to scroll, and tap a sentence in the article to read its count.

Tides

Most coasts have two high tides and two low tides in a little more than a day. The interval is about 24 hours and 50 minutes, because the Moon moves along its orbit while the Earth turns, so a point on the Earth needs the extra time to face the Moon again.

The Moon's gravity pulls harder on the side of the Earth that faces it than on the far side. The difference stretches the oceans into two bulges, one towards the Moon and one away from it. A coast passes through both bulges as the Earth rotates.

The Sun raises tides in the same way. It's far more massive than the Moon and also far more distant, and its effect on the tides is a little less than half of the Moon's.

When the Sun, the Earth and the Moon are in a line, at new moon and at full moon, the two effects add. These are spring tides, with the highest high water and the lowest low water. The name has nothing to do with the season.

When the Moon is at first or third quarter, the Sun and the Moon pull at right angles and partly cancel. These are neap tides, with a small difference between high and low water.

The shape of the coast matters more than either body. In the open ocean the tide is well under a metre. A funnel-shaped bay can raise it to more than ten metres, as in the Bay of Fundy in Canada.

Tide tables are worked out years ahead. The tide at a port is treated as a sum of regular waves, each with a period set by the motions of the Earth, the Moon and the Sun, and the size of each wave is fitted from past measurements at that port.

Show the code counters, runs, the heat and the minimap
  1. The article inside <selection-fx> with the effect named heat, and an empty column for the minimap.
  2. The column is an element, so it can take a drag.
  3. Record a selection: add one to the counter of each character.
  4. Runs of equal heat and their rectangles.
  5. Draw the heat, the text, then the minimap.
  6. The minimap is one more drawElementImage() of the same element with a small width and height.
  7. Drag in the column to scroll the page.

How it works

The page keeps one counter per character of the article. A selection is turned into a start and an end offset and adds one to each counter between them. Before drawing, the counters are grouped into runs of characters with the same level, and each run is measured with Range.getClientRects(). The canvas fills those rectangles, draws the article over them, and then draws the article a second time into a rectangle 54 pixels wide. An element's picture can only be drawn into the canvas it belongs to, which is why the minimap is inside the article's own canvas and not in a separate one beside it. The counters are saved in localStorage in this browser. Nothing is sent anywhere.

Live checks

These start when you press the button. They use their own fixture.

Findings

Measured in headless Chromium 157 on Linux with a software renderer, 2026-11-21.

Not verified: how smoothly the minimap follows a touch scroll on a phone, dragging in the column by touch, and selections collected from real readers (this page has no server).