Class: CameraState

CameraState(center, width) → {CameraState}

Defines the state of a camera to facilitate the manipulation of it

Found in Chapter 7, page 353 of the textbook

Examples: 7.2 Camera Interpolations, 7.3 Camera Shake and Object Oscillation

Constructor

new CameraState(center, width) → {CameraState}

Parameters:
Name Type Description
center vec2 the center world coordinates of the Camera
width float the width of the Camera
Source:
Returns:
a new CameraState instance
Type
CameraState

Methods

config(stiffness, duration)

Configure the interpolation of the CameraState
Parameters:
Name Type Description
stiffness float the rate for the interpolations
duration integer the number of cycles for the interpolations
Source:

getCenter() → {LerpVec2}

Returns the vec2 linear interpolation object for the center of this Camera
Source:
Returns:
a vec2 linear inperolation object for the center of this Camera
Type
LerpVec2

getWidth() → {Lerp}

Returns the linear interpolation object for the width of this Camer
Source:
Returns:
a linear inperolation object for the center of this Camera
Type
Lerp

setCenter(c)

Sets the target value for the center LerpVec2 and begins the interpolation
Parameters:
Name Type Description
c vec2 the target value for the center LerpVec2
Source:

setWidth(c)

Sets the target value for the width Lerp and begins the interpolation. As the width interpolates so will the Camera height
Parameters:
Name Type Description
c float the target value for the width Lerp
Source:

update()

Update the CameraState interpolation values
Source: