CameraOptions
Options for Camera
interface CameraOptions
Properties
Camera's horizontal FOV(Field of View). (in degrees, °)
Initial pitch (x-axis rotation) value for camera. (in degrees, °)
As View360 uses right-handed coordinate system internally, positive value will make camera to look upside, while negative value will look down.
Initial yaw (y-axis rotation) value for camera. (in degrees, °)
As View360 uses right-handed coordinate system internally, camera will rotate counter-clockwise by this value.
Initial zoom value for camera.
Setting this value to 2
will enlarge panorama 200% by width.
Restrict pitch(x-axis rotation) range. (in degrees, °)
Restrict yaw(y-axis rotation) range. (in degrees, °)
Restrict camera zoom range.
If null
, a default zoom range from 0.6
to 10
will be used.
Properties
fov
fovnumber
90
Camera's horizontal FOV(Field of View). (in degrees, °)
// Init with fov: 120
const viewer = new View360("#el_id", { fov: 120 });
// Back to 90
viewer.fov = 90;
initialPitch
initialPitchnumber
0
Initial pitch (x-axis rotation) value for camera. (in degrees, °)
As View360 uses right-handed coordinate system internally, positive value will make camera to look upside, while negative value will look down.
const viewer = new View360("#el_id", {
initialPitch: 60
});
viewer.on("ready", () => {
console.log(viewer.camera.pitch); // 60
});
initialYaw
initialYawnumber
0
Initial yaw (y-axis rotation) value for camera. (in degrees, °)
As View360 uses right-handed coordinate system internally, camera will rotate counter-clockwise by this value.
const viewer = new View360("#el_id", {
initialYaw: 30
});
viewer.on("ready", () => {
console.log(viewer.camera.yaw); // 30
});
initialZoom
initialZoomnumber
1
Initial zoom value for camera.
Setting this value to 2
will enlarge panorama 200% by width.
const viewer = new View360("#el_id", {
initialZoom: 2
});
viewer.on("ready", () => {
console.log(viewer.camera.zoom); // 2
});
pitchRange
pitchRangenull | Range
null
Restrict pitch(x-axis rotation) range. (in degrees, °)
const viewer = new View360("#el_id", {
pitchRange: [-45, 45]
});
viewer.on("ready", () => {
console.log(viewer.camera.pitch); // 0
viewer.camera.lookAt({ pitch: 60 });
console.log(viewer.camera.pitch); // 45
});
yawRange
yawRangenull | Range
Restrict yaw(y-axis rotation) range. (in degrees, °)
const viewer = new View360("#el_id", {
yawRange: [-30, 30]
});
viewer.on("ready", () => {
console.log(viewer.camera.yaw); // 0
viewer.camera.lookAt({ yaw: 60 });
console.log(viewer.camera.yaw); // 30
});
zoomRange
zoomRangenull | Range
null
Restrict camera zoom range.
If null
, a default zoom range from 0.6
to 10
will be used.
const viewer = new View360("#el_id", {
zoomRange: [0.5, 4]
});
viewer.on("ready", () => {
console.log(viewer.camera.zoom); // 1
viewer.camera.lookAt({ zoom: 6 });
console.log(viewer.camera.zoom); // 4
});