Page navigations drawn by a shader that starts at the clicked link

A four-page site inside one canvas. Tap a card or a link: the address changes, and a shader spreads the new page from the element you tapped. Back and Forward do the same. Both pages are live DOM while the shader runs.

    Show the code the Navigation API driving a transition shader
    1. The first view, inside <live-transition>. Ordinary links and a GET form. The other views are files in /nav-shader/views/.
    2. Intercept every navigation. precommitHandler fetches the new view while the old URL is still in the address bar. After the commit, the shader runs. sourceElement is the link or button that was used.
    3. A view becomes a new child of the element. Each child is a state with its own texture.
    4. The shader. origin is the centre of the clicked element. GLSL and WGSL.
    5. Without the Navigation API. A click listener and history.pushState().
    6. Inside the element: each state is uploaded as a texture when it repaints.
    7. The whole file.

    How it works

    <live-transition> draws its children in one canvas and blends two of them with a fragment shader, with WebGPU when it works and WebGL otherwise. This page adds the navigation. One navigate listener intercepts links, the GET form, Back and Forward. Its precommitHandler fetches the new view's HTML and appends it as a child, which defers the URL change until the view is ready. Its post-commit handler calls show() with the centre of event.sourceElement as the origin, and the navigation is finished when the shader has finished.

    Views are kept after they are first loaded, so text typed into one is there on the way back. Reloading at ?view=knots starts on that view.

    Live checks

    ResultExperimentDetail

    Findings