Sets the camera’s position and orientation to values that are in-between those of two other cameras.
myCamera.slerp() uses spherical linear interpolation to calculate a position and orientation that’s in-between two other cameras. Doing so is helpful for transitioning smoothly between two perspectives.
The first two parameters, cam0 and cam1, are the p5.Camera objects that should be used to set the current camera.
The third parameter, amt, is the amount to interpolate between cam0 and cam1. 0.0 keeps the camera’s position and orientation equal to cam0’s, 0.5 sets them halfway between cam0’s and cam1’s , and 1.0 sets the position and orientation equal to cam1’s.
For example, calling myCamera.slerp(cam0, cam1, 0.1) sets cam’s position and orientation very close to cam0’s. Calling myCamera.slerp(cam0, cam1, 0.9) sets cam’s position and orientation very close to cam1’s.
Note: All of the cameras must use the same projection.
Ejemplos
Sintaxis
slerp(cam0, cam1, amt)
Parámetros
first camera.
second camera.
amount of interpolation between 0.0 (cam0) and 1.0 (cam1).
Referencias Relacionadas
camera
camera() establece la posición y orientación de la cámara actual en un dibujo 3D.
createCamera
Crea un nuevo objeto p5.Camera y lo establece como la cámara actual (activa).
frustum
frustum() cambia la perspectiva por defecto de la cámara actual en un boceto 3D.
linePerspective
Habilita o deshabilita la perspectiva de las líneas en bocetos 3D.