GltfAnimationStartOptions
@RequiresApi(value = 26)
@ExperimentalGltfAnimationApi
public final class GltfAnimationStartOptions
Animation options for starting a GltfAnimation.
| Throws | |
|---|---|
IllegalArgumentException |
if |
Summary
Public constructors |
|---|
GltfAnimationStartOptions( |
Public methods |
|
|---|---|
final @NonNull GltfAnimationStartOptions |
Creates a copy of the |
boolean |
|
final @NonNull Duration |
The start offset. |
final float |
getSpeed()The playback rate. |
int |
hashCode() |
final boolean |
Whether the animation plays in a loop. |
@NonNull String |
toString() |
Public constructors
GltfAnimationStartOptions
public GltfAnimationStartOptions(
boolean shouldLoop,
float speed,
@NonNull Duration seekStartTime
)
Public methods
copy
public final @NonNull GltfAnimationStartOptions copy(boolean shouldLoop, float speed, @NonNull Duration seekStartTime)
Creates a copy of the GltfAnimationStartOptions object with the given values.
getSeekStartTime
public final @NonNull Duration getSeekStartTime()
The start offset. Default is Duration.ZERO.
This value defines the starting boundary of the playback window. The effective playback window is the range between seekStartTime and the animation's total duration.
Constraints:
-
Must be greater than or equal to zero.
-
If
seekStartTimeis greater than the duration, it is clamped to the duration (resulting in a zero-length playback window).
Note on Reverse Playback: If speed is negative and shouldLoop is false, the animation stops when it reaches seekStartTime. To play in reverse, the application must explicitly call GltfAnimation.seekTo to set the playhead to a valid position between seekStartTime and the duration.
getSpeed
public final float getSpeed()
The playback rate. Default is 1.0.
-
1.0: Normal speed.
-
> 1.0: Faster playback.
-
> 0.0 and < 1.0: Slower playback (e.g., 0.5 is half speed).
-
0.0: Freezes the animation at the current frame while keeping it active.
-
< 0.0: Plays the animation in reverse.
shouldLoop
public final boolean shouldLoop()
Whether the animation plays in a loop.