Package icyllis.modernui.animation
Interface TimeInterpolator
- All Known Implementing Classes:
AnticipateOvershootInterpolator,BezierInterpolator,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.
This interface provides some constant interpolators and methods to create simple
interpolators, see MotionEasingUtils for creating common bezier-based
easing interpolators.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TimeInterpolatorThe constant accelerate interpolator whose factor is 1.0.static final TimeInterpolatorThe interpolator where the rate of change starts and ends slowly but accelerates through the middle.static final TimeInterpolatorThe constant anticipate interpolator whose tension is 2.0.static final TimeInterpolatorThe constant anticipate/overshoot interpolator whose tension is 2.0.static final TimeInterpolatorThe bounce interpolator where the change bounces at the end.static final TimeInterpolatorThe constant decelerate interpolator whose factor is 1.0.static final TimeInterpolatorThe constant decelerate interpolator whose factor is 1.5.static final TimeInterpolatorThe constant decelerate interpolator whose factor is 2.5.static final TimeInterpolatorThe linear interpolator.static final TimeInterpolatorThe constant overshoot interpolator whose tension is 2.0.static final TimeInterpolatorThe constant cycle interpolator that indicates 1/4 cycle sine wave.static final TimeInterpolator -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeInterpolatorReturn an interpolator where the rate of change starts out slowly and then accelerates.static TimeInterpolatoraccelerate(float factor) Create an interpolator where the rate of change starts out slowly and then accelerates.static TimeInterpolatorReturn an interpolator where the change starts backward then flings forward.static TimeInterpolatoranticipate(float tension) Create an interpolator where the change starts backward then flings forward.static TimeInterpolatorbounce()Return an interpolator where the change bounces at the end.static TimeInterpolatorcycle(float cycle) Create a cycle interpolator which repeats the animation for a specified number of cycles.static TimeInterpolatorReturn an interpolator where the rate of change starts out quickly and then decelerates.static TimeInterpolatordecelerate(float factor) Create an interpolator where the rate of change starts out quickly and then decelerates.floatgetInterpolation(float progress) Get interpolation value.static TimeInterpolatorlinear()Return a linear interpolator (identity).static TimeInterpolatorReturn an interpolator where the change flings forward and overshoots the last value then comes back.static TimeInterpolatorovershoot(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. Ifcycleis 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
-