Conveyor belt list: an endless list from ten elements, drawn round two rollers
A list with no first and no last row, shown as the face of a conveyor belt. Rows come up from underneath round the bottom roller, travel up the flat face, and go over the top roller to the back. The document holds ten row elements whatever the position: an element that has gone over a roller is given the content of the next row to arrive.
The belt
Drag the belt up or down, or flick it. Tick a parcel or open it: each row is a real element with a checkbox and a button. The motor runs the belt by itself.
Rows are numbered from 0 and the numbers go on in both directions. Arrow keys and Page Up and Page Down move the belt while something in it has the focus. The wheel moves it while the pointer is over it.
Show the code
How it works
The canvas has ten drawable children. Row i of the list is shown by element i mod 10, so an element is refilled only when its row is past the crest of a roller.
Moving the belt doesn't draw any element. Each element's picture is drawn with drawElementImage() once after it changes, copied into a plain canvas with drawImage(), and wiped. A frame of the belt is cut from that copy: one piece for the part of a row on the flat face, and pieces 3 px of belt long round a roller, each drawn shorter, narrower and darker by the angle it has turned.
Because no element is drawn where it appears, the canvas tells the browser where each row is with updateElementGeometry(). That's what lets a tap reach a checkbox on a moving row.
Show the code
Live checks
These run on their own fixtures, after a tap.
Findings
Measured in headless Chromium 157 on 2026-11-22. Not yet run on a phone.
- Ten elements show any row. At row 1,000,000 and at row -5 the canvas had 10 children, and a tap on the checkbox of row 1,000,002 ticked it.
- A tick is kept by row number. Row 4 was still ticked after its element had shown other rows on the way to row 1,000,000 and back.
- Moving the belt draws no element. A touch drag of 190 px drew 53 frames and copied 6 element pictures to the atlas. A flick that carried the belt about 740 px drew about 166 frames and copied 18.
updateElementGeometry()moves the hit box of an element that is not on the canvas at that place: in the fixture the button was found at 160, 110 where the canvas pixel was 0, 0, 0, 0, and was not found where it had been drawn and wiped.- A
drawImage()copy taken inside the paint handler holds the element's picture (0, 160, 0, 255) after the drawable canvas is wiped in the same handler. - A paint event named an element whose text changed although the paint before it left nothing of the element on the canvas.
- A tap reached the checkbox of a row moving at 160 px a second with the motor on. A drag that started on a checkbox moved the belt and didn't tick the box.
- A row that is mostly round a roller takes no input: the element 26 px down the canvas is the canvas.
- One
contextlostevent stops the canvas and shows the ten rows as plain HTML. Tested by dispatching the event. - Not verified: Chrome 159 on Android, the frame rate on a phone, and a screen reader on a feed whose rows are reused.