Package voltage.utility

# Class SmoothValue

java.lang.Object
voltage.utility.SmoothValue

public class SmoothValue extends Object
A simple class that lets you smoothly transition from one value to another. This will help avoid stair stepping and drastic fluxuations. For example, this is used in the Glide module where you can smoothly transition from one value to another over a specific amount of time.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SmoothValue()`
  Constructs a SmoothValue object
  `SmoothValue(double startValue)`
  Constructs a SmoothValue object

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `GetSmoothValue()`
  Gets the current smoothed value of this object.
  `double`
  `GetTargetValue()`
  Gets the target value.
  `double`
  `GetValue()`
  Gets the current smoothed value of this object.
  `void`
  `ResetValue(double newValue)`
  Sets the current and destination value to be the same value.
  `void`
  `SetFixedTime(double glideMilliseconds, double deltaValue)`
  Sets a fixed amount to glide to in a fixed amount of time.
  `void`
  `SetGlideTime(double glideMilliseconds)`
  Sets the amount of time to move to the destination value.
  `void`
  `SetValue(double newValue)`
  Sets a new target value.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SmoothValue

    public SmoothValue()
    Constructs a SmoothValue object

  - ### SmoothValue

    public SmoothValue(double startValue)
    Constructs a SmoothValue object
    Parameters:
      `startValue` - the first value to add.

- ## Method Details

  - ### SetGlideTime

    public void SetGlideTime(double glideMilliseconds)
    Sets the amount of time to move to the destination value. For example: SetGlideTime(1000.0) then will take 1 second to glide from one value to another, regardless of the difference between the current value and the destination value.
    Parameters:
      `glideMilliseconds` - time in milliseconds.

  - ### SetFixedTime

    public void SetFixedTime(double glideMilliseconds, double deltaValue)
    Sets a fixed amount to glide to in a fixed amount of time. For example: SetFixedTime(1000, 1.0) will take 1 second to glide a distance of 1.0. Meaning a change from 0 to 5.0 would take 5 seconds.
    Parameters:
      `glideMilliseconds` - time in milliseconds.
      `deltaValue` - the amount to change in glideMilliseconds.

  - ### SetValue

    public void SetValue(double newValue)
    Sets a new target value.
    Parameters:
      `newValue` - the new destination target.

  - ### ResetValue

    public void ResetValue(double newValue)
    Sets the current and destination value to be the same value.
    Parameters:
      `newValue` - the new value to set the destination and current value to.

  - ### GetValue

    public double GetValue()
    Gets the current smoothed value of this object.
    Returns:
      the current smoothed value.

  - ### GetSmoothValue

    public double GetSmoothValue()
    Gets the current smoothed value of this object.
    Returns:
      the current smoothed value.

  - ### GetTargetValue

    public double GetTargetValue()
    Gets the target value.
    Returns:
      the target value.