← all demos · chapter 04

Infinite scroll — one tile, endless world

Make a seamless tile repeat, then slide the reading position (in shaders: the UV offset) by time. The tile below is generated in code, then scrolled forever at two speeds for instant cheap depth.

The % 80 is the secret: after one tile-width, the offset resets and no one can tell. That's the whole "infinite."

Try tweaking: speeds 12/40 → 40/12 (near becomes far) · vertical scrolling: translate(0, -offset) and fillRect(0, 0, W, H + 80) · hues 235/270 → 10/30 for drifting embers-sky.

In Godot: a one-line shader — UV += vec2(TIME * 0.03, 0.0); (import the texture with Repeat on; download scroll_uv.gd + its shader). In Unity: material.mainTextureOffset += new Vector2(speed * Time.deltaTime, 0);. In Unreal: the material Panner node exists precisely for this. Chapter 04.