Camera
class Camera
Camera that renders the scene of View3D
constructor
new Camera(view3D)
Create new Camera instance
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
view3D | View3D | An instance of View3D |
Properties
threeCamera
Three.js PerspectiveCamera instance
Type: THREE.PerspectiveCamera
defaultPose
Camera's default pose(yaw, pitch, zoom, pivot)
This will be new currentPose when reset() is called
Type: Pose
Returns: Pose
currentPose
Camera's current pose value
Type: Pose
Returns: Pose
newPose
Camera's new pose that will be applied on the next frame
Camera#updatePosition should be called after changing this value.
Type: Pose
Returns: Pose
yaw
Camera's current yaw
Camera#updatePosition should be called after changing this value.
Type: number
pitch
Camera's current pitch
Camera#updatePosition should be called after changing this value.
Type: number
zoom
Camera's current zoom value
Camera#updatePosition should be called after changing this value.
Type: number
distance
Camera's disatance from current camera pivot(target)
Type: number
baseDistance
Camera's default distance from the model center.
This will be automatically calculated based on the model size.
Type: number
baseFov
Camera's default fov value.
This will be automatically chosen when view3D.fov
is "auto", otherwise it is equal to view3D.fov
Type: number
pivot
Current pivot point of camera rotation
Type: THREE.Vector3
See:
fov
Camera's focus of view value (vertical)
Type: number
See:
renderWidth
Camera's frustum width
Type: number
renderHeight
Camera's frustum height
Type: number
Methods
reset
Reset camera to default pose
Returns: Promise<void>
- Promise that resolves when the animation finishes
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
duration | number | ✔️ | 0 | Duration of the reset animation |
easing | function | ✔️ | DEFAULT.EASING | Easing function for the reset animation |
pose | Pose | ✔️ | Pose to reset, camera will reset to defaultPose if pose is not given. |
resize
Update camera's aspect to given size
Returns: void
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
size | object | New size to apply | ||
size.width | number | ✔️ | null | New width |
size.height | number | ✔️ | New height |
fit
Fit camera frame to the given model
Returns: void
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
model | Model | |||
center | "auto" | number[] |
updatePosition
Update camera position
Returns: void