aspect ratioed

This commit is contained in:
2026-09-16 00:04:23 +02:00
parent 6cbe8ae739
commit cb88c84777
+7 -2
View File
@@ -62,8 +62,13 @@ export default function ParticleScene({ keyframes, onLabel, onProgress }: Props)
const resize = () => { const resize = () => {
renderer.setPixelRatio(Math.min(devicePixelRatio, 2)) renderer.setPixelRatio(Math.min(devicePixelRatio, 2))
renderer.setSize(innerWidth, innerHeight, false) renderer.setSize(innerWidth, innerHeight, false)
camera.aspect = innerWidth / innerHeight; camera.updateProjectionMatrix() const aspect = innerWidth / innerHeight
camera.position.z = innerWidth < 760 ? 26 : 18 camera.aspect = aspect; camera.updateProjectionMatrix()
// fixed vertical FOV means horizontal FOV shrinks on portrait screens; back the
// camera off enough that the widest shape (the "PQ" text sweep, ~8 units half-width)
// still fits the frustum instead of getting cropped on narrow viewports
const halfV = Math.tan(camera.fov * Math.PI / 360)
camera.position.z = 8.2 / (halfV * Math.min(aspect, 1))
} }
// scroll: real fraction for the bar, section-keyed progress for the morph // scroll: real fraction for the bar, section-keyed progress for the morph