This class provides static helper methods that provide friendlier names for
timing functions (interpolators) used in animations. For example, one can
write "Timings.easeInOut()
" instead of
"new AcceleratingDeceleratingInterpolator()
". The former notation
can be shorted even further by writing
"import static sofia.graphics.Timings.*
".
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Timings()
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static
AnticipateInterpolator
|
backIn()
A timing function where the change starts backward and then flings forward. | ||||||||||
static
AnticipateInterpolator
|
backIn(float tension)
A timing function where the change starts backward and then flings forward. | ||||||||||
static
AnticipateOvershootInterpolator
|
backInOut()
A timing function where the change starts backward, then flings forward, overshooting the end value, and then slowly settles back. | ||||||||||
static
AnticipateOvershootInterpolator
|
backInOut(float tension, float factor)
A timing function where the change starts backward, then flings forward, overshooting the end value, and then slowly settles back. | ||||||||||
static
AnticipateOvershootInterpolator
|
backInOut(float tension)
A timing function where the change starts backward, then flings forward, overshooting the end value, and then slowly settles back. | ||||||||||
static
OvershootInterpolator
|
backOut(float tension)
A timing function where the change flings forward, overshooting the end value, and then slowly settles back. | ||||||||||
static
OvershootInterpolator
|
backOut()
A timing function where the change flings forward, overshooting the end value, and then slowly settles back. | ||||||||||
static
BounceInterpolator
|
bounce()
A timing function that causes the animation to "bounce". | ||||||||||
static
CycleInterpolator
|
cycle(float cycles)
A timing function that causes the animation to cycle forward and backward in a sinusoidal pattern. | ||||||||||
static
AccelerateInterpolator
|
easeIn()
A timing function where the rate of change starts slowly and then speeds up until it ends. | ||||||||||
static
AccelerateInterpolator
|
easeIn(float factor)
A timing function where the rate of change starts slowly and then speeds up until it ends, based on a specified factor. | ||||||||||
static
AccelerateDecelerateInterpolator
|
easeInOut()
A timing function where the rate of change starts and ends slowly but speeds up through the middle. | ||||||||||
static
DecelerateInterpolator
|
easeOut()
A timing function where the rate of change starts quickly and then slows down until it ends. | ||||||||||
static
DecelerateInterpolator
|
easeOut(float factor)
A timing function where the rate of change starts quickly and then slows down until it ends, based on a specified factor. | ||||||||||
static
ElasticInInterpolator
|
elasticIn()
A timing function that elastically snaps from the start value. | ||||||||||
static
ElasticInOutInterpolator
|
elasticInOut()
A timing function that elastically snaps in from the start value and then snaps back again when it reaches the end value. | ||||||||||
static
ElasticOutInterpolator
|
elasticOut()
A timing function that elastically snaps back when it reaches the end value. | ||||||||||
static
LinearInterpolator
|
linear()
A timing function where the rate of change is constant. |
Methods inherited from
class
java.lang.Object
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Object
|
clone()
| ||||||||||
boolean
|
equals(Object arg0)
| ||||||||||
void
|
finalize()
| ||||||||||
final
Class<?>
|
getClass()
| ||||||||||
int
|
hashCode()
| ||||||||||
final
void
|
notify()
| ||||||||||
final
void
|
notifyAll()
| ||||||||||
String
|
toString()
| ||||||||||
final
void
|
wait()
| ||||||||||
final
void
|
wait(long arg0, int arg1)
| ||||||||||
final
void
|
wait(long arg0)
|
A timing function where the change starts backward and then flings forward.
This timing function is represented by
f(t) = t^2 * (3 * t - 2)
,
where t is the current time in the animation normalized to the
range [0.0, 1.0]. (In other words, it is equivalent to
backIn(float)
with a tension of 2.0.)
This timing function corresponds to AnticipateInterpolator.
a timing function that starts backward and then flings forward
A timing function where the change starts backward and then flings forward.
This timing function is represented by
f(t) = t^2 * ((tension + 1) * t - tension)
,
where t is the current time in the animation normalized to the
range [0.0, 1.0]. Higher values of tension
cause the
animation to "pull backward" more and then accelerate faster when
"snapped"; a tension
value of 0 makes it identical to
easeIn()
.
This timing function corresponds to AnticipateInterpolator.
a timing function that starts backward and then flings forward
A timing function where the change starts backward, then flings forward, overshooting the end value, and then slowly settles back.
This timing function is represented by
TODO
,
where t is the current time in the animation normalized to the
range [0.0, 1.0]. (In other words, it is equivalent to
backInOut(float)
with a tension of 2.0.)
This timing function corresponds to AnticipateOvershootInterpolator.
a timing function that starts backward, flings forward past the end point and then settles back to the end
A timing function where the change starts backward, then flings forward, overshooting the end value, and then slowly settles back.
This timing function is represented by
TODO
,
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to AnticipateOvershootInterpolator.
a timing function that flings forward past the end point and then settles back to the end
A timing function where the change starts backward, then flings forward, overshooting the end value, and then slowly settles back.
This timing function is represented by
TODO
,
where t is the current time in the animation normalized to the
range [0.0, 1.0]. (In other words, it is equivalent to
backInOut(float)
with a tension of 2.0.)
This timing function corresponds to AnticipateOvershootInterpolator.
a timing function that flings forward past the end point and then settles back to the end
A timing function where the change flings forward, overshooting the end value, and then slowly settles back.
This timing function is represented by
f(t) = (t - 1)^2 * ((tension + 1)(t - 1) + tension) + 1
,
where t is the current time in the animation normalized to the
range [0.0, 1.0]. (In other words, it is equivalent to
backOut(float)
with a tension of 2.0.)
This timing function corresponds to OvershootInterpolator.
a timing function that flings forward past the end point and then settles back to the end
A timing function where the change flings forward, overshooting the end value, and then slowly settles back.
This timing function is represented by
f(t) = (t - 1)^2 * ((tension + 1)(t - 1) + tension) + 1
,
where t is the current time in the animation normalized to the
range [0.0, 1.0]. (In other words, it is equivalent to
backOut(float)
with a tension of 2.0.)
This timing function corresponds to OvershootInterpolator.
a timing function that flings forward past the end point and then settles back to the end
A timing function that causes the animation to "bounce".
This timing function is represented by a piecewise function:
f(t) = 8 * (1.1226 * t)^2, if 0 <= t < 0.3535 = 8 * (1.1226 * t - 0.54719)^2 + 0.7, if 0.3535 <= t < 0.7408, = 8 * (1.1226 * t - 0.8526)^2 + 0.9, if 0.7408 <= t < 0.9644, = 8 * (1.1226 * t - 1.0435)^2 + 0.95, if 0.9644 <= t <= 1,where t is the current time in the animation normalized to the range [0.0, 1.0].
To elaborate, an animation that uses this timing function will ease in (accelerate) from start to end in about 31% of its duration, then "bounce" (accelerating backward and then decelerating forward) to the 66% point in its duration, bounce again with less strength to the 86% point, and then bounce one more time until the end of the duration, with each bounce occurring at less strength than the one before.
This timing function corresponds to BounceInterpolator.
a timing function that causes the animation to bounce
A timing function that causes the animation to cycle forward and backward in a sinusoidal pattern.
This timing function is represented by
f(t) = sin(2 * cycles * pi)
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to CycleInterpolator.
a timing function that causes the animation to cycle
A timing function where the rate of change starts slowly and then speeds up until it ends.
This timing function is represented by
f(t) = t^2
,
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to AccelerateInterpolator.
a timing function that eases in an accelerating animation
A timing function where the rate of change starts slowly and then speeds up until it ends, based on a specified factor.
This timing function is represented by
f(t) = t^(2 * factor)
,
where t is the current time in the animation normalized to the
range [0.0, 1.0]. A factor of 1.0 produces the same result as
easeIn()
; larger values exaggerate the effect (the animation
eases in more slowly but ends much faster).
This timing function corresponds to AccelerateInterpolator.
a timing function that eases in an accelerating animation
A timing function where the rate of change starts and ends slowly but speeds up through the middle. This is the default timing function for any animation that does not specify an alternative.
This timing function is represented by
f(t) = 0.5 + cos((1 + t) * pi) / 2
,
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to AccelerateDecelerateInterpolator.
a timing function that eases in and eases out an animation
A timing function where the rate of change starts quickly and then slows down until it ends.
This timing function is represented by
f(t) = 1 - (1 - t)^2
,
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to DecelerateInterpolator.
a timing function that eases out a decelerating animation
A timing function where the rate of change starts quickly and then slows down until it ends, based on a specified factor.
This timing function is represented by
f(t) = 1 - (1 - t)^(2 * factor)
,
where t is the current time in the animation normalized to the
range [0.0, 1.0]. A factor of 1.0 produces the same result as
easeOut()
; larger values exaggerate the effect (the animation
starts more quickly but eases out much more slowly).
This timing function corresponds to DecelerateInterpolator.
a timing function that eases out a decelerating animation
A timing function that elastically snaps from the start value.
This timing function is represented by
TODO
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to ElasticInInterpolator
(which is a custom interpolator provided by Sofia, not one built into
the Android API).
a timing function that causes the animation to snap in
A timing function that elastically snaps in from the start value and then snaps back again when it reaches the end value.
This timing function is represented by
TODO
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to ElasticInOutInterpolator
(which is a custom interpolator provided by Sofia, not one built into
the Android API).
a timing function that causes the animation to snap at the beginning and end
A timing function that elastically snaps back when it reaches the end value.
This timing function is represented by
TODO
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to ElasticOutInterpolator
(which is a custom interpolator provided by Sofia, not one built into
the Android API).
a timing function that causes the animation to snap back
A timing function where the rate of change is constant.
This timing function is represented by
f(t) = t
,
where t is the current time in the animation normalized to the
range [0.0, 1.0].
This timing function corresponds to LinearInterpolator.
a timing function that is constant