public final class AnimationFunctions extends Object
AnimationFunction
s.AnimationFunction
Modifier and Type | Class and Description |
---|---|
static class |
AnimationFunctions.InterpolationMode |
Modifier and Type | Field and Description |
---|---|
static AnimationFunction<Float> |
ONE
A constant
AnimationFunction that returns
1f all the time. |
static AnimationFunction<Float> |
ZERO
A constant
AnimationFunction that returns
0f all the time. |
Modifier and Type | Method and Description |
---|---|
static AnimationFunction<Color> |
alphaColor(AnimationFunction<Integer> f,
Color baseColor)
Creates and returns an animation function that returns time-based
sRGB colors that are built from a given base color and
an animation function of alpha values.
|
static <T> AnimationFunction<T> |
concat(AnimationFunction<T>... functions)
Concatenates the given animation functions and returns a compound
animation function that represents the concatenation.
|
static <T> AnimationFunction<T> |
constant(long duration,
T value)
Creates and returns an animation function that returns a constant value
over the given duration.
|
static <T> AnimationFunction<T> |
discrete(long duration,
T... values)
Creates and returns a discrete animation function for the
given duration and values.
|
static <T> AnimationFunction<T> |
discrete(long duration,
T[] values,
float[] keyTimes)
Creates and returns a discrete animation function for the given duration,
values and interpolation key times.
|
static AnimationFunction<Float> |
fromBy(long duration,
float from,
float by)
Creates and returns a linear animation function for the given duration
that returns Float in interval [from, from + by].
|
static AnimationFunction<Float> |
fromTo(long duration,
float from,
float to)
Creates and returns a linear animation function with the given duration.
|
static <T extends Number> |
linear(long duration,
T[] values)
Creates and returns a linear animation function that is defined
by an array of numeric values; these are distributed equally
over the duration.
|
static <T extends Number> |
linear(long duration,
T[] values,
float[] keyTimes)
Creates and returns a linear animation function that is defined
by an array of numeric values and an array of relative key times.
|
static AnimationFunction<Color> |
linearColors(long duration,
Color[] colors,
float[] keyTimes)
Creates an
AnimationFunction that maps times
to instances of Color . |
static AnimationFunction<Integer> |
random(int min,
int max,
float changeProbability)
Creates and returns an animation function that returns random values
from the interval [min, max] with a given change probability.
|
static <T> AnimationFunction<T> |
repeat(AnimationFunction<T> f,
long repeatTime)
Creates and returns an animation function that is defined
by repeating the specified animation function.
|
static <T> AnimationFunction<T> |
reverse(AnimationFunction<T> f)
Creates and returns an animation function that is defined
by reverting the given animation function in time.
|
public static final AnimationFunction<Float> ONE
AnimationFunction
that returns
1f
all the time.public static final AnimationFunction<Float> ZERO
AnimationFunction
that returns
0f
all the time.public static AnimationFunction<Color> alphaColor(AnimationFunction<Integer> f, Color baseColor)
Useful for fading effects.
f
- the animation function of alpha valuesbaseColor
- the base colorpublic static <T> AnimationFunction<T> concat(AnimationFunction<T>... functions)
functions
- the animation functions to concatenatepublic static <T> AnimationFunction<T> constant(long duration, T value)
duration
- the function's durationvalue
- the Object that will be returned all the timepublic static <T> AnimationFunction<T> discrete(long duration, T... values)
duration
- the function's durationvalues
- an array of discrete result valuespublic static <T> AnimationFunction<T> discrete(long duration, T[] values, float[] keyTimes)
duration
- the function's durationvalues
- an array of discrete result valueskeyTimes
- an array of key times used to distribute the
result values over the timepublic static AnimationFunction<Float> fromBy(long duration, float from, float by)
duration
- the animation durationfrom
- the initial result valueby
- the difference that is added to the initial valuepublic static AnimationFunction<Float> fromTo(long duration, float from, float to)
duration
- the animation durationfrom
- the initial result valueto
- the last result valuepublic static <T extends Number> AnimationFunction<T> linear(long duration, T[] values)
duration
- the animation durationvalues
- an array of valuespublic static <T extends Number> AnimationFunction<T> linear(long duration, T[] values, float[] keyTimes)
duration
- the animation durationvalues
- an array of valueskeyTimes
- an array of key times used to distribute the
result values over the timepublic static AnimationFunction<Color> linearColors(long duration, Color[] colors, float[] keyTimes)
AnimationFunction
that maps times
to instances of Color
. The mapping is interpolated
from an array of Colors using an array of key times.duration
- the duration of this animation functioncolors
- the colors to interpolate.keyTimes
- an array of key times used to distribute
the result values over the time.AnimationFunction
that maps times to sRGB colors.
This mapping is defined by an array of Color
values
and a corresponding array of key times that is used to interpolate
sub-AnimationFunction for the red, green, blue and alpha values.public static AnimationFunction<Integer> random(int min, int max, float changeProbability)
min
- the minimum result valuemax
- the maximum result valuechangeProbability
- the probability that the value changespublic static <T> AnimationFunction<T> repeat(AnimationFunction<T> f, long repeatTime)
f
- the animation function to repeatrepeatTime
- the time to repeat the functionpublic static <T> AnimationFunction<T> reverse(AnimationFunction<T> f)
f
- the animation function to reverseCopyright © 2018 JGoodies Software GmbH. All rights reserved.