Package com.xebisco.yield
Class Animation
java.lang.Object
com.xebisco.yield.Animation
- All Implemented Interfaces:
Closeable,AutoCloseable
Represents an animation made up of multiple frames.
-
Constructor Summary
ConstructorsConstructorDescriptionAnimation(boolean loop, double delay, AbstractTexture... frames) Constructor with customizable loop and delay.Animation(AbstractTexture... frames) Constructor with looping enabled and 0.5-second delay. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes all frames of the animation.doubledelay()Returns the delay between frames in seconds.frames()Returns the frames of the animation.booleanloop()Returns whether the animation should loop.setDelay(double delay) Sets the delay between frames in seconds.setFrames(AbstractTexture[] frames) Sets the frames of the animation.setLoop(boolean loop) Sets whether the animation should loop.
-
Constructor Details
-
Animation
Constructor with looping enabled and 0.5-second delay.- Parameters:
frames- The frames of the animation.
-
Animation
Constructor with customizable loop and delay.- Parameters:
loop- Whether the animation should loop.delay- The delay between frames in seconds.frames- The frames of the animation.
-
-
Method Details
-
close
Closes all frames of the animation.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- If an I/O error occurs.
-
frames
Returns the frames of the animation.- Returns:
- The frames of the animation.
-
setFrames
Sets the frames of the animation.- Parameters:
frames- The new frames of the animation.- Returns:
- This animation instance for chaining.
-
delay
public double delay()Returns the delay between frames in seconds.- Returns:
- The delay between frames in seconds.
-
setDelay
Sets the delay between frames in seconds.- Parameters:
delay- The new delay between frames in seconds.- Returns:
- This animation instance for chaining.
-
loop
public boolean loop()Returns whether the animation should loop.- Returns:
- Whether the animation should loop.
-
setLoop
Sets whether the animation should loop.- Parameters:
loop- Whether the animation should loop.- Returns:
- This animation instance for chaining.
-