-
Notifications
You must be signed in to change notification settings - Fork 0
5. Animation
Important! This section of the library is still under heavy development. APIs may change frequently.
The Value interface is designed as the base for a sort of Tween system. Many properties use it so they can be changed automatically over time.
Note: At the moment, only ParticleData updates its Value objects automatically. Sorry for the inconvenience!
A Value instance holding a single object without any special effects can be created like so:
// stored object may be changed
Value.value("hello world");
// stored object cannot be changed
Value.constant(12.5f);
Currently, the most useful Value implementation is Range, which interpolates between two objects over time.
new Range(ColorRGBA.Green, ColorRGBA.Red, Interpolator.Color, Ease.inLinear);
At time=0
, Range will store a completely green color. At time=1
, Range will store a completely red color. Times in between will be blends of green and red.
Another useful implementation of Value is Random, which generates a stores a random object between two base objects whenever it is updated.
// picks and stores a new random value between 2 and 5 once every second
new Random(2f, 5f, Interpolator.Float, 1f);
Disclaimer: This system is not very powerful, and certainly not up to snuff for serious animation! Eventually, this will be addressed, but in the meantime, drivers are pretty good at animating properties of particles and particle groups.