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
AnimationState
within
an Animation
and is typically used to decide how an animation should behave.-
Method Summary
Modifier and TypeMethodDescriptionstatic LifeSpan
endingNowWith
(LifeTime lifeTime) boolean
long
getEndTimeIn
(TimeUnit unit, long iteration) Returns the end time of the specified iteration in the given time unit.long
getStartTimeIn
(TimeUnit unit) Returns the time when the animation should start in the given time unit.int
hashCode()
boolean
Allows you to check whether the animation is expired or not.lifeTime()
static LifeSpan
startingNowWith
(LifeTime lifeTime) static LifeSpan
startingNowWithOffset
(long offset, TimeUnit unit, LifeTime lifeTime) long
toString()
-
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:
true
if the animation is expired,false
otherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-