-
Notifications
You must be signed in to change notification settings - Fork 0
5. Animation
The Value interface is designed to represent a single, animated value. Many library features use this for their properties, so they can easily be animated if necessary.
Value comes with a simple implementation that does not provide animation, but the internal value can be set directly.
Value.value("my string");
Another implementation makes the internal value constant. Obviously, this cannot be animated.
Value.constant(45);
The most useful Value implementation is Range, which interpolates the internal value between two extremes. The internal value cannot be set directly. Here is an Integer Range that has the extremes at 1 and 15, with linear easing:
Range<Integer> myRange = new Range<>(1, 15, Interpolator.Integer, Easing.linear);
Range requires an Interpolator, which performs linear interpolation between two objects. The Interpolator interface provides several implementations for a number of common objects and primitives.