Package swingtree.animation
Class LifeSpan
java.lang.Object
swingtree.animation.LifeSpan
The lifespan defines when an
This object is intended to be accessed as part of an
Animation starts and for how long it should run.
It consists of a start time and LifeTime, which defines a delay, interval and duration
as well as a unique id which ensures that two instances of this class are never equal.
This object is intended to be accessed as part of an
AnimationStatus within
an Animation and is typically used to decide how an animation should behave.-
Method Summary
Modifier and TypeMethodDescriptionstatic LifeSpanendingNowWith(LifeTime lifeTime) booleanlonggetEndTimeIn(TimeUnit unit, long iteration) Returns the end time of the specified iteration in the given time unit.longgetStartTimeIn(TimeUnit unit) Returns the time when the animation should start in the given time unit.inthashCode()booleanAllows you to check whether the animation is expired or not.lifeTime()static LifeSpanstartingNowWith(LifeTime lifeTime) static LifeSpanstartingNowWithOffset(long offset, TimeUnit unit, LifeTime lifeTime) longtoString()
-
Method Details
-
startingNowWith
-
startingNowWithOffset
-
endingNowWith
-
lifeTime
-
startTime
public long startTime() -
getStartTimeIn
Returns the time when the animation should start in the given time unit.- Parameters:
unit- The time unit in which the start time should be returned.- Returns:
- The time when the animation should start.
-
getEndTimeIn
Returns the end time of the specified iteration in the given time unit. The end time is the time when the animation is scheduled to be finished. This is essentially the start time plus the duration of the animation times the provided iteration number.- Parameters:
unit- The time unit in which the end time should be returned.iteration- The iteration for which the end time should be determined and returned.- Returns:
- The end time of the specified iteration in the given time unit.
-
isExpired
public boolean isExpired()Allows you to check whether the animation is expired or not. An animation is considered expired if the current time is greater than the start time plus the duration of the animation.- Returns:
trueif the animation is expired,falseotherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-