Package icyllis.modernui.animation
Interface TimeInterpolator
- All Known Implementing Classes:
AnticipateOvershootInterpolator
,BounceInterpolator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An interpolator defines the rate of change of an animation. This allows animations
to have non-linear motion, such as acceleration and deceleration.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final TimeInterpolator
The constant accelerate interpolator whose factor is 1.0.static final TimeInterpolator
The interpolator where the rate of change starts and ends slowly but accelerates through the middle.static final TimeInterpolator
The constant anticipate interpolator whose tension is 2.0.static final TimeInterpolator
The constant anticipate/overshoot interpolator whose tension is 2.0.static final TimeInterpolator
The bounce interpolator where the change bounces at the end.static final TimeInterpolator
The constant decelerate interpolator whose factor is 1.0.static final TimeInterpolator
The constant decelerate interpolator whose factor is 1.5.static final TimeInterpolator
The constant decelerate interpolator whose factor is 2.5.static final TimeInterpolator
The linear interpolator.static final TimeInterpolator
The constant overshoot interpolator whose tension is 2.0.static final TimeInterpolator
The constant cycle interpolator that indicates 1/4 cycle sine wave.static final TimeInterpolator
-
Method Summary
Modifier and TypeMethodDescriptionstatic TimeInterpolator
Return an interpolator where the rate of change starts out slowly and then accelerates.static TimeInterpolator
accelerate
(float factor) Create an interpolator where the rate of change starts out slowly and then accelerates.static TimeInterpolator
Return an interpolator where the change starts backward then flings forward.static TimeInterpolator
anticipate
(float tension) Create an interpolator where the change starts backward then flings forward.static TimeInterpolator
bounce()
Return an interpolator where the change bounces at the end.static TimeInterpolator
cycle
(float cycle) Create a cycle interpolator which repeats the animation for a specified number of cycles.static TimeInterpolator
Return an interpolator where the rate of change starts out quickly and then decelerates.static TimeInterpolator
decelerate
(float factor) Create an interpolator where the rate of change starts out quickly and then decelerates.float
getInterpolation
(float progress) Get interpolation value.static TimeInterpolator
linear()
Return a linear interpolator (identity).static TimeInterpolator
Return an interpolator where the change flings forward and overshoots the last value then comes back.static TimeInterpolator
overshoot
(float tension) Create an interpolator where the change flings forward and overshoots the last value then comes back.
-
Field Details
-
LINEAR
The linear interpolator. -
ACCELERATE
The constant accelerate interpolator whose factor is 1.0.- See Also:
-
DECELERATE
The constant decelerate interpolator whose factor is 1.0.- See Also:
-
DECELERATE_CUBIC
The constant decelerate interpolator whose factor is 1.5.- See Also:
-
DECELERATE_QUINTIC
The constant decelerate interpolator whose factor is 2.5.- See Also:
-
ACCELERATE_DECELERATE
The interpolator where the rate of change starts and ends slowly but accelerates through the middle. -
SINE
The constant cycle interpolator that indicates 1/4 cycle sine wave.- See Also:
-
ANTICIPATE
The constant anticipate interpolator whose tension is 2.0.- See Also:
-
OVERSHOOT
The constant overshoot interpolator whose tension is 2.0.- See Also:
-
ANTICIPATE_OVERSHOOT
The constant anticipate/overshoot interpolator whose tension is 2.0.- See Also:
-
BOUNCE
The bounce interpolator where the change bounces at the end. -
VISCOUS_FLUID
-
-
Method Details
-
getInterpolation
float getInterpolation(float progress) Get interpolation value. This interpolated value is then multiplied by the change in value of an animation to derive the animated value at the current elapsed animation time.- Parameters:
progress
- [0.0, 1.0] determined by timeline, 0.0 represents the start and 1.0 represents the end- Returns:
- the interpolated value. this value can be more than 1.0 for those overshoot their targets, or less than 0 for those undershoot their targets.
-
linear
Return a linear interpolator (identity).- Returns:
- a linear interpolator
-
accelerate
Return an interpolator where the rate of change starts out slowly and then accelerates.- Returns:
- an accelerate interpolator
-
accelerate
Create an interpolator where the rate of change starts out slowly and then accelerates.- Parameters:
factor
- acceleration factor- Returns:
- an accelerate interpolator
-
decelerate
Return an interpolator where the rate of change starts out quickly and then decelerates.- Returns:
- a decelerate interpolator
-
decelerate
Create an interpolator where the rate of change starts out quickly and then decelerates.- Parameters:
factor
- deceleration factor- Returns:
- a decelerate interpolator
- See Also:
-
cycle
Create a cycle interpolator which repeats the animation for a specified number of cycles. The rate of change follows a sinusoidal pattern. Ifcycle
is 0.25f, a constant object will be returned. -
anticipate
Return an interpolator where the change starts backward then flings forward.- Returns:
- an anticipate interpolator
-
anticipate
Create an interpolator where the change starts backward then flings forward.- Parameters:
tension
- anticipation tension- Returns:
- an anticipate interpolator
-
overshoot
Return an interpolator where the change flings forward and overshoots the last value then comes back.- Returns:
- an overshoot interpolator
-
overshoot
Create an interpolator where the change flings forward and overshoots the last value then comes back.- Parameters:
tension
- overshoot tension- Returns:
- an overshoot interpolator
-
bounce
Return an interpolator where the change bounces at the end.- Returns:
- a bounce interpolator
-