summaryrefslogtreecommitdiffstats
path: root/src/demos/xtrans/InterpolatedFloat.java
blob: 398e3b4bdda8699d17963d28704db812080a8709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package demos.xtrans;

import gleem.linalg.*;

/** A floating-point value which interpolates between specified start
    and end values. */

public class InterpolatedFloat {
  private float start;
  private float end;

  /** Returns the starting value for the interpolation. */
  public float getStart() { return start; }

  /** Sets the starting value for the interpolation. */
  public void setStart(float val) { start = val; }

  /** Returns the ending value for the interpolation. */
  public float getEnd() { return end; }

  /** Sets the ending value for the interpolation. */
  public void setEnd(float val) { end = val; }

  /** Gets the current interpolated value at the specified fraction of
      interpolation (0.0 - 1.0). */
  public float getCurrent(float fraction) { 
    return (start * (1.0f - fraction)) + (end * fraction);
  }
}