Skip to content

5. Animation

codex edited this page May 20, 2024 · 5 revisions

The Value Interface

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);

Range

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.

Force Fields (feature preview)

Force fields are volumes that affect particle behavior. Force fields are similar to drivers, however, force fields are not bound to any specific particle group. They effect any group that has a ForceFieldDriver attached to them.

Additionally, force fields can affect other game objects, especially physical objects.

Clone this wiki locally