Class Spline
java.lang.Object
org.pushingpixels.radiance.animation.api.ease.Spline
- All Implemented Interfaces:
TimelineEase
Spline easer. Is based on the code from
TimingFramework by Chet
Haase and Romain Guy.
- Author:
- Kirill Grouchnikov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatmap(float lengthFraction) Given a fraction of time along the spline (which we can interpret as the length along a spline), return the interpolated value of the spline.
-
Constructor Details
-
Spline
public Spline(float easeAmount) -
Spline
public Spline(float x1, float y1, float x2, float y2) Creates a new instance of SplineInterpolator with the control points defined by (x1, y1) and (x2, y2). The anchor points are implicitly defined as (0, 0) and (1, 1).- Parameters:
x1- X coordinate of the first control pointy1- Y coordinate of the first control pointx2- X coordinate of the second control pointy2- Y coordinate of the second control point- Throws:
IllegalArgumentException- This exception is thrown when values beyond the allowed [0,1] range are passed in
-
-
Method Details
-
map
public float map(float lengthFraction) Given a fraction of time along the spline (which we can interpret as the length along a spline), return the interpolated value of the spline. We first calculate the t value for the length (by doing a lookup in our array of previousloy calculated values and then linearly interpolating between the nearest values) and then calculate the Y value for this t.- Specified by:
mapin interfaceTimelineEase- Parameters:
lengthFraction- Fraction of time in a given time interval.- Returns:
- interpolated fraction between 0 and 1
-