01The idea
Scroll a column of pictures quickly and they bend, like a sheet pulled over a drum: the middle sinks away from you and the edges stay close. When the scroll stops, the sheet settles flat again.
It looks like a 3D scene with a perspective camera. It isn’t. The camera is flat, and the depth is faked in one vertex shader, driven by a single number: how fast you’re scrolling.
02The shader
Each vertex knows where it sits on the screen. The closer it is to the middle, the further back it goes, scaled by the speed. A parabola does the work: 1.0 - y * y is 1 in the middle and 0 at the edges.
// bend each vertex by its height on the screen
uniform float uSpeed; // 0 at rest, 1 at full speed
uniform float uDepth; // how far the middle can sink, e.g. 0.38
varying vec2 vUv;
void main() {
vec4 p = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
float y = clamp(p.y, -1.0, 1.0); // -1 at the bottom, 1 at the top
float sink = uSpeed * uDepth * (1.0 - y * y); // the middle sinks most
p.xy *= 1.0 - sink; // further back reads as smaller
gl_Position = p;
vUv = uv;
}03Driving it with speed
The speed comes from the scroll: how far the page moved since the last frame, eased so it never jumps. At rest it falls back to zero, and the sheet flattens with it.
