aspect ratioed
This commit is contained in:
@@ -62,8 +62,13 @@ export default function ParticleScene({ keyframes, onLabel, onProgress }: Props)
|
||||
const resize = () => {
|
||||
renderer.setPixelRatio(Math.min(devicePixelRatio, 2))
|
||||
renderer.setSize(innerWidth, innerHeight, false)
|
||||
camera.aspect = innerWidth / innerHeight; camera.updateProjectionMatrix()
|
||||
camera.position.z = innerWidth < 760 ? 26 : 18
|
||||
const aspect = innerWidth / innerHeight
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user