Skip to content

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.

ReturnsSignatureSummary
ResourceAnimationof(int width, int height, int plays, List frames) factoryCreates an animation of width × height pixels that plays plays times (0 forever) through frames.

ReturnsSignatureSummary
long[]getEnds()Returns a copy of the end time of each frame, in milliseconds from the start.
longgetDuration()Returns the length of one play, in milliseconds.
intindexAt(long time)Returns the index of the frame shown at time milliseconds into a play.
intgetWidth()Returns the width of the animation, in pixels.
intgetHeight()Returns the height of the animation, in pixels.
intgetPlays()Returns how many times the animation plays, 0 for forever.
List<ResourceAnimationFrame>getFrames()Returns the frames, in order, as a list you cannot change.

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.

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.


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

Report a problem with this page