Class: CameraShake

CameraShake(state, xDelta, yDelta, shakeFrequency, shakeDuration) → {CameraShake}

new CameraShake(state, xDelta, yDelta, shakeFrequency, shakeDuration) → {CameraShake}

Defines a damped simple harmonic motion to simulate camera shake

damped simple harmonic shake motion

Parameters:
Name Type Description
state CameraState CameraState to be shaked.
xDelta Number how large a shake
yDelta Number how large a shake
shakeFrequency Number how much movement
shakeDuration Number for how long in number of cycles
Source:
Returns:
new instance of CameraShake
Type
CameraShake

Methods

getCenter() → {vec2}

Return the world coordinate center of the camera
Source:
Returns:
WC center of the camera
Type
vec2

setRefCenter(c) → {void}

Set the CameraShakes center refrence
Parameters:
Name Type Description
c Array.<Float> (x,y) center position
Source:
Returns:
Type
void

shakeDone() → {Boolean}

Return the shake status
Source:
Returns:
true if shake is done
Type
Boolean

updateShakeState() → {void}

Update the shake state of the camera
Source:
Returns:
Type
void