ResourceAnimation
final class ResourceAnimation
Package: dev.joid.lib.resource.animation · Module: core · Source: ResourceAnimation.java
The decoded frames of an animated image, with its size and its play count.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
ResourceAnimation | of(int width, int height, int plays, List | Creates an animation of width × height pixels that plays plays times (0 forever) through frames. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
long[] | getEnds() | Returns a copy of the end time of each frame, in milliseconds from the start. |
long | getDuration() | Returns the length of one play, in milliseconds. |
int | indexAt(long time) | Returns the index of the frame shown at time milliseconds into a play. |
int | getWidth() | Returns the width of the animation, in pixels. |
int | getHeight() | Returns the height of the animation, in pixels. |
int | getPlays() | Returns how many times the animation plays, 0 for forever. |
List<ResourceAnimationFrame> | getFrames() | Returns the frames, in order, as a list you cannot change. |
Creation details
Section titled “Creation details”ResourceAnimation of(int width, int height, int plays, List<ResourceAnimationFrame> frames) factory
Throws:
IllegalArgumentException: An animation needs at least one frame, got none: check that the file holds its frames
Creates an animation of width × height pixels that plays plays times (0 forever) through frames.
A frame shorter than 1 ms lasts 1 ms.
Throws IllegalArgumentException when frames is empty.
Method details
Section titled “Method details”getEnds
Section titled “getEnds”long[] getEnds()
Returns a copy of the end time of each frame, in milliseconds from the start.
getDuration
Section titled “getDuration”long getDuration()
Returns the length of one play, in milliseconds.
indexAt
Section titled “indexAt”int indexAt(long time)
Returns the index of the frame shown at time milliseconds into a play.
getWidth
Section titled “getWidth”int getWidth()
Returns the width of the animation, in pixels.
getHeight
Section titled “getHeight”int getHeight()
Returns the height of the animation, in pixels.
getPlays
Section titled “getPlays”int getPlays()
Returns how many times the animation plays, 0 for forever.
getFrames
Section titled “getFrames”List<ResourceAnimationFrame> getFrames()
Returns the frames, in order, as a list you cannot change.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
