AngleSpring
Inherits Observable
Observable object which simulates critically damped spring easing towards
another observable's value, clamping its output to the range [-pi, pi].
Constructor
Dex.AngleSpring
Dex.AngleSpring<T>(
target: Observable<T>
angularFrequency: number?
) -> AngleSpring<T>
Creates an easing observable that simulates the behavior of a critically damped spring, wrapped around the range [-pi, pi]. The spring simulates in realtime until the target value is reached.
INFO
AngleSprings must currently be Subscribed or Mounted to exhibit expected behavior. This is a requirement for all realtime-simulated observables, which enables safe garbage collection when writing Dex components.
Functions
ResetVelocity
AngleSpring:ResetVelocity() → ()Sets the velocity of the spring to the zero (or the origin vector). Useful in conjunction with Spring:SetPosition
CurrentTarget
AngleSpring:CurrentTarget() → ()Gets the current value of the spring's target observable.
SetPosition
AngleSpring:SetPosition() → ()Moves the current position of the spring to a new value, keeping the current velocity intact.