would be very, very hard in vanilla threejs. in 15 years no one has managed to make a re-usable out of this problem. there’s the multiple elements demo but that’s a long way from production.
react-three-fiber has a full re-usable for it drei/View.
each view is directly in your html, linked to a single, shared canvas (you can’t have multiple canvas in threejs, at least not without fearing tab crashes). each view is fully self contained and behaves as if it were a singleton canvas, you can throw controls in there, environments, etc. view containers behave like any other dom element, you can move them relative/absolute or use css transform (like in the demo, they’re moving/scaling because css keyframes).
if you want to try in vanilla, here are some things i’ve learned:
this is all based on a single 100vw/100vh canvas that fills the screen
you use gl.skissor to cut the rendering into portions
canvas and dom need to be under a shared parent from which all events are registered, otherwise canvas will block events for the dom or the other way round
javascript scroll is not in sync with requestanimationframe-loops, you need a javascript based scroll solution like lenis, no way around it