Package me.hsgamer.hscore.animate
Class Animation<T>
java.lang.Object
me.hsgamer.hscore.animate.Animation<T>
- Type Parameters:
T
- the frame type
The animation that gets the frame based on the period
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the frame based on the current timegetCurrentFrame
(long currentMillis) Get the frame based on the current timeGet the framesboolean
Check if it's the first run.boolean
isFirstRun
(long currentMillis) Check if it's the first run.void
reset()
Reset the animation
-
Constructor Details
-
Animation
Create a new animation- Parameters:
frames
- the framesperiodMillis
- the period in milliseconds
-
-
Method Details
-
getFrames
Get the frames- Returns:
- the frames
-
getCurrentFrame
Get the frame based on the current time- Parameters:
currentMillis
- the current time in milliseconds- Returns:
- the frame
-
getCurrentFrame
Get the frame based on the current time- Returns:
- the frame
-
reset
public void reset()Reset the animation -
isFirstRun
public boolean isFirstRun(long currentMillis) Check if it's the first run. It will return true if the animation is running for the first time.- Parameters:
currentMillis
- the current time in milliseconds- Returns:
- true if it's the first run
-
isFirstRun
public boolean isFirstRun()Check if it's the first run. It will return true if the animation is running for the first time.- Returns:
- true if it's the first run
-