Optionalconfig: LuxarOrbitControlsConfigCamera-frame axis or fixed scene axis the turntable revolves around; see AutoRotateAxis. Also the default axis of applyOrbitRotation, so programmatic turntables (recording) follow the same choice as the interactive one.
Auto-dolly: oscillate the orbit distance on a sine while enabled — the
turntable's radial sibling. Gated on enableZoom rather than
enableRotate, so it also runs in ortho mode (where it modulates
camera.zoom; see math/auto-dolly.ts).
Switching it OFF leaves the camera exactly where it is, mid-swing or not, and freezes the phase there. That is deliberate, and it is what the turntable does: disabling auto-rotation does not rewind the scene to the angle it started from, so disabling the dolly must not rewind the distance either (measured: rotation jumps 0.000° on disable, and a snap-back would have teleported the camera by up to 95% of the viewing distance in a single frame at max amplitude). Re-enabling resumes from the frozen phase, so nothing jumps in either direction and a completed cycle still returns to wherever the user left it.
Private_Seconds per full dolly oscillation.
PrivatecameraPrivatedomPrivateorientationPrivatedistancePrivaterotationPrivatepanPrivatezoomPrivaterollPrivatedollyAuto-dolly oscillation phase (radians, wrapped to [0, 2π)). NOT a
damping accumulator: the dolly is applied to the distance directly, and
this is only the clock it reads. Phase 0 is the baseline distance moving
inward, so enabling the feature starts with an approach.
PrivatepointersPrivatepointerPrivatestatePrivaterotatePrivatepanPrivatedollyPrivatetrackballPrivatelastPrivatelastPrivatetarget0Privateposition0Privateorientation0Privatezoom0PrivateboundPrivateboundPrivateboundPrivateboundPrivateboundPrivateviewPrivatekeyboardPeak dolly swing as a fraction of distance (0.15 = ±15%). While the dolly is running, assigning re-derives the position at the current phase while preserving the baseline. While it is switched off, assigning does not move the camera because the frozen position is the user's framing (see autoDolly).
Update controls. Call every frame.
OptionaldeltaTime: number
Optional time since last frame (seconds). Used for frame-rate independent auto-rotation.
true if the view changed — camera position, orientation, or orthographic zoom (useful for render-on-demand).
PrivatemakeSave current state for reset().
Restore to last saved state.
Apply an orbit rotation by the given angle (radians).
Rotation angle in radians (positive = counter-clockwise when looking along the axis).
Optionalaxis: Vector3
World-space axis to rotate around. Defaults to the axis autoRotateAxis names (screen-up unless changed) — the SAME axis interactive auto-rotation uses, so a recorded turntable cannot rotate unlike the preview it was set up from.
This is the same quaternion math that auto-rotation uses — call it from turntable recording or any other code that needs to orbit the camera programmatically.
Move the auto-dolly to an absolute oscillation phase (radians) and apply
the resulting distance change.
The programmatic counterpart of the per-frame dolly, for the same reason
applyOrbitRotation exists: offline capture drives the camera from
a FRAME INDEX, not from wall-clock time (its frames wait on LOD settling,
so deltaTime there is meaningless), and both paths must agree on what
the oscillation is. Passing an absolute phase rather than an increment
lets a recording close its loop exactly — phase 2π lands on the same
distance as phase 0, with no accumulated error.
Uses the configured autoDollyAmplitude, so a recording breathes as deeply as the preview. Does nothing while enableZoom is false.
Absolute oscillation phase in radians.
Remove the currently applied dolly offset and restart from phase zero.
Re-derive orientation and distance from the current camera position and target. Call after changing the target externally to keep the orbit state consistent.
Keep the current pose but discard residual user-input damping.
PrivateapplyEnable Shift+scroll view-axis rotation (roll around the viewing axis). Uses capture phase to intercept before other wheel handlers (zoom, FOV). Works in both orbit and ortho modes.
Clean up all event listeners.
PrivatemakePrivatepanPrivateapplyApply orientation + distance + target to camera transform.
PrivateinitializeExtract orientation and distance from current camera state.
minDistance (scene diagonal × minDistanceFactor once scale limits
are known) supplies the scale-relative degenerate-distance floor —
see camera-application.ts.
PrivatemakePrivateonPrivateonPrivateonPrivateonEnable keyboard controls (arrow keys for panning). Call with the element that should receive key events (typically window or canvas).
Stop listening for keyboard events.
Unified orbit/ortho camera controls with quaternion rotation and exponential damping.
Combines the damping, pan, and zoom math of three.js
OrbitControlswith the gimbal-lock-free quaternion rotation of a virtual-trackballArcballControls, and works with bothPerspectiveCameraandOrthographicCamera. Pointer gestures accumulate into per-frame delta buffers (rotation/pan/zoom/roll) that are applied fractionally and decayed each update, giving the smooth "weighted" feel; Shift+scroll view-axis roll feeds the same damped buffers, while auto-rotation is applied directly in the same update step.This same class backs both the manager's orbit (3D) and ortho (2D) modes, each with its own instance —
ControlsManagerdisposes and reconstructs a fresh instance on every orbit↔ortho switch, which is why the manager persists its stored distance/zoom limits across that recreation. reinitialize re-derives the internal distance and orientation from the live camera after external camera edits, and saveState/reset snapshot and restore the full pose.See
ControlsManager which owns and switches between control modes