Class: CameraShake

CameraShake(state, deltas, freqs, shakeDuration)

Defines a damped simple harmonic motion to shake a Camera

Found in Chapter 7, page 365 of the textbook

Example: 7.3 Camera Shake and Object Oscillation

Constructor

new CameraShake(state, deltas, freqs, shakeDuration)

Parameters:
Name Type Description
state CameraState the CameraState to be shaken
deltas vec2 the [x,y] magnitudes of the shake
freqs float the frequency of the shaking in revolutions per cycle
shakeDuration float the number of cycles for the shaking
Source:

Methods

done() → {boolean}

Returns whether the shake of this CameraShake has completed
Source:
Returns:
true if the shake is done
Type
boolean

getCenter() → {vec2}

Returns the world coordinate center of this CameraShake
Source:
Returns:
mShakeCenter - world coordinate center of the Camera
Type
vec2

reShake()

Resets the duration of this CameraShake
Source:

setRefCenter(c)

Set the center origin reference for this CameraShake
Parameters:
Name Type Description
c Array.<float> the x,y world coordinate values to be set
Source:

update()

Update the shake state of the camera
Source: