BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

PerspectiveCamera.toJSON()

The PerspectiveCamera.toJSON() method is used to serialize a PerspectiveCamera object into a JSON format that can be used to persist the state of the camera for later use or transmission over a network.

Signature

PerspectiveCamera.toJSON()

Description

The PerspectiveCamera.toJSON() method returns a JSON representation of the PerspectiveCamera instance, including its position, rotation, field of view, aspect ratio, and clipping planes.

The JSON representation can be used to create a new PerspectiveCamera instance with the same properties as the original one.

Example

const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
const cameraJson = camera.toJSON();
const newCamera = new THREE.PerspectiveCamera().fromJSON(cameraJson);

Parameters

The PerspectiveCamera.toJSON() method does not take any parameters.

Return Value

The PerspectiveCamera.toJSON() method returns a JSON object that represents the current state of the PerspectiveCamera instance.

Exceptions

The PerspectiveCamera.toJSON() method does not throw any exceptions.

Notes

The PerspectiveCamera.toJSON() method does not include any image or texture data.

Any additional object properties or methods that are defined on the PerspectiveCamera instance will be omitted from the JSON serialization.

See Also

References