Skip to content

Latest commit

 

History

History
54 lines (30 loc) · 1.22 KB

lerpable_vector.md

File metadata and controls

54 lines (30 loc) · 1.22 KB

LerpableVector

from tdw.lerp.lerpable_vector import LerpableVector

A numpy array of a 3-element vector that can be linearly interpolated between minimum and maximum values.


Fields

  • value The current value.

  • is_at_target If True, self.value is at its target (the minimum if increasing, the maximum if decreasing).


Functions

__init__

__init__

LerpableVector(value)

Parameter Type Default Description
value T The initial value.

update

self.update()

Interpolate. If we're done interpolating, stop.

This will set self.value to a value between the minimum and maximum.

set_target

self.set_target(target, dt)

Set a new target for self.value.

One end of the line between a and b will be self.value and the other will be target.

Parameter Type Default Description
target T The target value.
dt float The true value delta per update() call. For example, if this is a position and you want move the position by 0.1 meters per update() call, then this value should be 0.1.

get_dt

self.get_dt()

Returns: The signed change in value.