com.jgoodies.animation
public final class AnimationFunctions extends java.lang.Object
AnimationFunction
s.AnimationFunction
Modifier and Type | Class and Description |
---|---|
static class |
AnimationFunctions.FloatFunction
Helper class that wraps a Float-based animation function to answer floats.
|
Modifier and Type | Field and Description |
---|---|
static AnimationFunction |
ONE
A constant
AnimationFunction that returns
1 all the time. |
static AnimationFunction |
ZERO
A constant
AnimationFunction that returns
0.0f all the time. |
Modifier and Type | Method and Description |
---|---|
static AnimationFunction |
alphaColor(AnimationFunction f,
java.awt.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 AnimationFunctions.FloatFunction |
asFloat(AnimationFunction f)
Creates a time-based function that wraps the given Float-based animation
function to return the corresponding float values.
|
static AnimationFunction |
concat(AnimationFunction first,
AnimationFunction second)
Concatenates the fiven animation functions and returns a compound
animation function that represents the concatenation.
|
static AnimationFunction |
constant(long duration,
java.lang.Object value)
Creates and returns an animation function that returns a constant value
over the given duration.
|
static AnimationFunction |
discrete(long duration,
java.lang.Object[] values)
Creates and returns a discrete animation function for the
given duration and values.
|
static AnimationFunction |
discrete(long duration,
java.lang.Object[] values,
float[] keyTimes)
Creates and returns a discrete animation function for the given duration,
values and interpolation key times.
|
static AnimationFunction |
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 |
fromTo(long duration,
float from,
float to)
Ceates and returns a linear animation function with the given duration.
|
static AnimationFunction |
linear(long duration,
java.lang.Object[] 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 AnimationFunction |
linear(long duration,
java.lang.Object[] 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 |
linearColors(long duration,
java.awt.Color[] colors,
float[] keyTimes)
Creates an
AnimationFunction that maps times
to instances of Color . |
static AnimationFunction |
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 AnimationFunction |
repeat(AnimationFunction f,
long repeatTime)
Creates and returns an animation function that is defined
by repeating the specified animation function.
|
static AnimationFunction |
reverse(AnimationFunction f)
Creates and returns an animation function that is defined
by reverting the given animation function in time.
|
public static final AnimationFunction ONE
AnimationFunction
that returns
1
all the time.public static final AnimationFunction ZERO
AnimationFunction
that returns
0.0f
all the time.public static AnimationFunction alphaColor(AnimationFunction f, java.awt.Color baseColor)
Useful for fading effects.
f
- the animation function of alpha valuesbaseColor
- the base colorpublic static AnimationFunctions.FloatFunction asFloat(AnimationFunction f)
f
- the underlying animation function of floatspublic static AnimationFunction concat(AnimationFunction first, AnimationFunction second)
first
- the concatenation's first AnimationFunctionsecond
- the concatenation's second AnimationFunctionpublic static AnimationFunction constant(long duration, java.lang.Object value)
duration
- the function's durationvalue
- the Object that will be returned all the timepublic static AnimationFunction discrete(long duration, java.lang.Object[] values)
duration
- the function's durationvalues
- an array of discrete result valuespublic static AnimationFunction discrete(long duration, java.lang.Object[] 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 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 fromTo(long duration, float from, float to)
duration
- the animation durationfrom
- the initial result valueto
- the last result valuepublic static AnimationFunction linear(long duration, java.lang.Object[] values)
duration
- the animation durationvalues
- an array of valuespublic static AnimationFunction linear(long duration, java.lang.Object[] 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 linearColors(long duration, java.awt.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 arry 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 random(int min, int max, float changeProbability)
min
- the minimum result valuemax
- the maximum result valuechangeProbability
- the probability that the value changespublic static AnimationFunction repeat(AnimationFunction f, long repeatTime)
f
- the animation function to repeatrepeatTime
- the time to repeat the functionpublic static AnimationFunction reverse(AnimationFunction f)
f
- the animation function to reverseCopyright © 2001-2006 JGoodies Karsten Lentzsch. All Rights Reserved.