Interface Progress
- All Known Implementing Classes:
AnimationState
-
Method Summary
Modifier and TypeMethodDescriptiondefault double
cycle()
Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.default double
cycleMinus
(double offset) Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.default double
cyclePlus
(double offset) Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.default double
fadeIn()
The animation progress in the form of peaking sine wave growing from 0 to 1 based on the equation0.5 * (1 + Math.sin( Math.PI * (progress() - 0.5) ) )
Just like the value returned byprogress()
thefadeIn()
value starts at 0 and ends at 1, however the crucial difference is that thefadeIn()
value grows according to a sine wave, which makes certain animations look more natural.default double
fadeIn
(double start, double end) The animation progress in the form of peaking sine wave growing fromstart
toend
based on the equationstart + (end - start) * fadeIn()
.default double
fadeOut()
The animation progress in the form of peaking sine wave growing from 1 to 0 based on the equation1 - fadeIn()
.default double
fadeOut
(double end, double start) The animation progress in the form of a sine wave going fromstart
toend
based on the equationend + (start - end) * fadeOut()
.default double
jumpIn()
The animation progress in the form of quickly growing sine wave front going from 0 to 1 based on the equationsin(PI * progress() / 2)
.default double
jumpIn
(double start, double end) The animation progress in the form of peaking sine wave growing fromstart
toend
based on the equationstart + (end - start) * jumpIn()
.default double
jumpOut()
The animation progress in the form of peaking sine wave growing from 1 to 0 based on the equationsin(PI * (1 - progress()) / 2)
.default double
jumpOut
(double end, double start) The animation progress in the form of a initially quickly changing sine wave going fromstart
toend
based on the equationend + (start - end) * jumpOut()
.double
progress()
Exposes the progress of the animation state, which is a number between 0 and 1 that represents how far the animation has progressed between its start and end.default double
progress
(double start, double end) The animation progress in the form of a value linearly growing fromstart
toend
based on the equationstart + (end - start) * progress()
.default double
pulse()
A sine wave oscillating between 0 and 1 and back to 0 once per iteration.default double
pulse
(double start, double peak) A sine wave oscillating betweenstart
andpeak
and back tostart
once per iteration.default double
regress()
The animation progress in the form of a value linearly growing from 1 to 0 based on the equation1 - progress()
.default double
regress
(double end, double start) The animation regression in the form of a value linearly growing fromstart
toend
.
-
Method Details
-
progress
double progress()Exposes the progress of the animation state, which is a number between 0 and 1 that represents how far the animation has progressed between its start and end. Note that an animation may also regress, in which case the states will transition from 1 to 0 instead of from 0 to 1. SeeStride
for more information.- Returns:
- The animation progress in terms of a number between 0 and 1, where 0.5 means the animation is halfway through, and 1 means the animation completed.
-
progress
default double progress(double start, double end) The animation progress in the form of a value linearly growing fromstart
toend
based on the equationstart + (end - start) * progress()
. At the beginning of the animation, the value isstart
, at the end of the animation, the value isend
.- Parameters:
start
- The start value of the animation.end
- The end value of the animation.- Returns:
- The animation progress in terms of a number between
start
andend
.
-
regress
default double regress()The animation progress in the form of a value linearly growing from 1 to 0 based on the equation1 - progress()
. At the beginning of the animation, the value is 1, at the end of the animation, the value is 0.- Returns:
- The animation progress in terms of a number between 0 and 1, where 0.5 means the animation is halfway through.
-
regress
default double regress(double end, double start) The animation regression in the form of a value linearly growing fromstart
toend
. This method is equivalent toprogress(end, start)
.- Parameters:
end
- The end value of the animation.start
- The start value of the animation.- Returns:
- The animation progress in terms of a number between
start
andend
.
-
pulse
default double pulse()A sine wave oscillating between 0 and 1 and back to 0 once per iteration. At the beginning of the animation, the value is 0, at the end of the animation, the value is 0 again, and when the animation is halfway through, the value is 1.- Returns:
- The animation progress in terms of a number between 0 and 1, where 1 means the animation is halfway through.
-
pulse
default double pulse(double start, double peak) A sine wave oscillating betweenstart
andpeak
and back tostart
once per iteration. At the beginning of the animation, the value isstart
, at the end of the animation, the value isstart
again, and when the animation is halfway through, the value ispeak
.- Parameters:
start
- The start value of the sine wave.peak
- The peak value of the sine wave.- Returns:
- The animation progress in terms of a number between
start
andend
, whereend
means the animation is halfway through.
-
jumpIn
default double jumpIn()The animation progress in the form of quickly growing sine wave front going from 0 to 1 based on the equationsin(PI * progress() / 2)
. Just like the value returned byprogress()
thejumpIn()
value starts at 0 and ends at 1, however the crucial difference is that thejumpIn()
value grows according to a sine wave, which makes certain animations look more natural.
The returned value will grow quickly at the beginning and slowly at the end, hence the name.- Returns:
- The animation progress in the form of peaking sine wave growing from 0 to 1.
-
jumpIn
default double jumpIn(double start, double end) The animation progress in the form of peaking sine wave growing fromstart
toend
based on the equationstart + (end - start) * jumpIn()
. Just like the value returned byprogress()
thejumpIn()
value starts atstart
and ends atend
, however the crucial difference is that thejumpIn()
value grows according to a sine wave, which makes certain animations look more natural.
The returned value will grow quickly at the beginning and slowly at the end, hence the name.- Parameters:
start
- The start value of the animation.end
- The end value of the animation.- Returns:
- The animation progress in the form of peaking sine wave growing from
start
toend
.
-
jumpOut
default double jumpOut()The animation progress in the form of peaking sine wave growing from 1 to 0 based on the equationsin(PI * (1 - progress()) / 2)
. Just like the value returned byprogress()
thejumpOut()
value starts at 1 and ends at 0, however the crucial difference is that thefadeOut()
value grows according to a sine wave, which makes certain animations look more natural.- Returns:
- The animation progress in the form of peaking sine wave growing from 1 to 0.
-
jumpOut
default double jumpOut(double end, double start) The animation progress in the form of a initially quickly changing sine wave going fromstart
toend
based on the equationend + (start - end) * jumpOut()
. Just like the value returned byprogress(double, double)
thejumpOut(double, double)
value starts atstart
and ends atend
, however the crucial difference is that thejumpOut(double, double)
value changes according to a sine wave, which makes certain animations look more natural.- Parameters:
end
- The end value of the animation,start
- The start value of the animation.- Returns:
- The animation progress in the form of peaking sine wave growing from
start
toend
.
-
fadeIn
default double fadeIn()The animation progress in the form of peaking sine wave growing from 0 to 1 based on the equation0.5 * (1 + Math.sin( Math.PI * (progress() - 0.5) ) )
Just like the value returned byprogress()
thefadeIn()
value starts at 0 and ends at 1, however the crucial difference is that thefadeIn()
value grows according to a sine wave, which makes certain animations look more natural.
The difference between this method andjumpIn()
is that the returned value grows slower at the beginning, wherejumpIn()
grows faster initially.- Returns:
- The animation progress in the form of peaking sine wave growing from 0 to 1.
-
fadeIn
default double fadeIn(double start, double end) The animation progress in the form of peaking sine wave growing fromstart
toend
based on the equationstart + (end - start) * fadeIn()
. Just like the value returned byprogress()
thefadeIn()
value starts atstart
and ends atend
, however the crucial difference is that thefadeIn()
value grows according to a sine wave, which makes certain animations look more natural.
The difference between this method andjumpIn()
is that the returned value grows slower at the beginning, wherejumpIn()
grows faster initially.- Parameters:
start
- The start value of the animation.end
- The end value of the animation.- Returns:
- The animation progress in the form of a wave growing from
start
toend
.
-
fadeOut
default double fadeOut()The animation progress in the form of peaking sine wave growing from 1 to 0 based on the equation1 - fadeIn()
. Just like the value returned byprogress()
thefadeOut()
value starts at 1 and ends at 0, however the crucial difference is that thefadeOut()
value grows according to a sine wave, which makes certain animations look more natural.
The difference between this method andjumpOut()
is that the returned value grows slower at the beginning, wherejumpOut()
grows faster initially.- Returns:
- The animation progress in the form of wave growing from 1 to 0.
-
fadeOut
default double fadeOut(double end, double start) The animation progress in the form of a sine wave going fromstart
toend
based on the equationend + (start - end) * fadeOut()
. Just like the value returned byprogress(double, double)
thefadeOut(double, double)
value starts atstart
and ends atend
, however the crucial difference is that thefadeOut(double, double)
value grows according to a sine wave, which makes certain animations look more natural.
The difference between this method andjumpOut()
is that the returned value grows slower at the beginning, whereasjumpOut()
grows faster initially.- Parameters:
end
- The end value of the animation,start
- The start value of the animation,- Returns:
- The animation progress in the form a sine wave going from
start
toend
.
-
cycle
default double cycle()Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.This is especially useful for animations that are supposed to be repeated or whose start and end values are the same (e.g. a fade-in and fade-out animation).
- Returns:
- The animation progress in terms of a number between 0 and 1, where 1 means the animation is halfway through and 0 means the animation started or finished.
-
cyclePlus
default double cyclePlus(double offset) Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.This is especially useful for animations that are supposed to be repeated or whose start and end values are the same (e.g. a fade-in and fade-out animation).
This method is similar to
cycle()
, but it allows to offset the animation progress. This is useful for animations that are supposed to be repeated and whose start and end values are different (e.g. a fade-in and fade-out animation).- Parameters:
offset
- The offset of the animation progress which may be any number. The modulo operator is used to offset the animation progress in a way that it is always between 0 and 1.- Returns:
- The animation progress in terms of a number between 0 and 1, where 1 means the animation is halfway through and 0 means the animation started or finished.
-
cycleMinus
default double cycleMinus(double offset) Defines the animation progress in terms of a number oscillating between 0, 1 and 0 once per iteration, meaning that when the animation starts, the value is 0, when it is halfway through, the value is 1, and when it is finished, the value is 0 again.This is especially useful for animations that are supposed to be repeated or whose start and end values are the same (e.g. a fade-in and fade-out animation).
This method is similar to the of
cyclePlus(double)
but with the offset being subtracted instead of added. The returned values is similar to the one returned bycycle()
, with the simple difference to offset the animation progress. This is useful for animations that are supposed to be repeated and whose start and end values are different (e.g. a fade-in and fade-out animation).- Parameters:
offset
- The offset of the animation progress which may be any number. The modulo operator is used to offset the animation progress in a way that it is always between 0 and 1.- Returns:
- The animation progress in terms of a number between 0 and 1, where 1 means the animation is halfway through and 0 means the animation started or finished.
-