Class: LerpVec2

LerpVec2(value, cycles, rate) → {LerpVec2}

Encapsulates linear interpolation of vec2, calls gl-matrixjs::lerp

Found in Chapter 7, page 353 of the textbook

Example: 7.2 Camera Interpolations

Constructor

new LerpVec2(value, cycles, rate) → {LerpVec2}

Parameters:
Name Type Description
value vec2 starting value of interpolation
cycles integer number of cycles it should take to reach the target value
rate float rate at which the value should change at each cycle
Source:
Returns:
a new LerpVec2 instance
Type
LerpVec2

Extends

Methods

_interpolateValue()

Performs a linear interpolation for this LerpVec2
Overrides:
Source:

config(stiffness, duration)

Sets the rate and number of cyles of this Lerp
Parameters:
Name Type Description
stiffness float the new rate for this Lerp
duration integer the new number of cycles for this Lerp
Inherited From:
Source:

get() → {float}

Returns the current value of this Lerp
Inherited From:
Source:
Returns:
mCurrentValue - the current value of this Lerp
Type
float

setFinal(v)

Sets the final value for this Lerp and starts interpolation
Parameters:
Name Type Description
v float the target value to be set
Inherited From:
Source:

update() → {void}

Method called by Gameloop, interpolates value if there are remaining cycles
Inherited From:
Source:
Returns:
Type
void