5.6 Camera (1) ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from examples/section-5/5.06-camera-1.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Imports: values (has, validate, the Holo*Error classes, the pure helpers) from @holostep-configurators/runtime-client, types from @holostep-configurators/runtime-client/contract, /math and /testing names from those entries; boot from the runtime module the root's loadRuntimeAtFloor resolves to. A type your page defines is your app's: declare it there, never import it from the package.

ts
import type { CameraView, Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
declare const planView: CameraView;                                // the app's plan framing (plan-camera.ts)
declare const baseOffsetY: number;                                  // the focal offset's y before any reveal
declare const revealShiftM: number;                                 // app math with camera.project: the overlap only, 0 when visible
// Plan view: no camera input, and no app limits (the target box included), so nothing clamps the framing.
await session.camera.mode('fixed');
await session.camera.limits(null);
await Promise.all([                                                   // separate targets: neither waits for the other
  session.camera.lens({ horizontalFovDeg: 10 }),
  session.camera.set(planView, { durationMs: 0 }),                    // exact, no damping
]);
// Mobile reveal above the sheet: an eased focal offset, measured from the unrevealed view.
const s = session.camera.state;
await session.camera.set({
  target: s.target, azimuthDeg: s.azimuthDeg, polarDeg: s.polarDeg, distance: s.distance,
  focalOffset: { ...s.focalOffset, y: baseOffsetY + revealShiftM },
}, { durationMs: 300 });

Back to the examples · llms.txt