Skip to main content
AnimationModifier is a record that configures how an animation should be played, including lerp timing, speed, loop behavior, and conditional execution.

Package

Record Components

Static Constants

DEFAULT

Default modifier with no customizations.

DEFAULT_WITH_PLAY_ONCE

Default modifier configured to play animation once without looping.

Builder Methods

builder()

Creates a new builder instance. Returns: A new AnimationModifier.Builder

toBuilder()

Converts this modifier to a builder with all current values preset. Returns: A builder initialized with this modifier’s values

Constructors

AnimationModifier(int, int)

Creates a modifier with only lerp timing.

AnimationModifier(int, int, float)

Creates a modifier with lerp timing and speed.

AnimationModifier(int, int, FloatSupplier)

Creates a modifier with lerp timing and dynamic speed.

AnimationModifier(int, int, AnimationIterator.Type)

Creates a modifier with lerp timing and loop type.

AnimationModifier(int, int, AnimationIterator.Type, FloatSupplier)

Creates a modifier with lerp timing, loop type, and speed.

AnimationModifier(BooleanSupplier, int, int, AnimationIterator.Type, FloatSupplier)

Creates a modifier with all core parameters.

Instance Methods

type(AnimationIterator.Type)

Returns the modifier’s type or the provided default if type is null.

speedValue()

Returns the current speed value, or 1.0 if no speed modifier is set.

predicateValue()

Evaluates the predicate, returning true if no predicate is set or if the predicate returns true.

override(boolean)

Returns the override flag if set, otherwise returns the provided original value.

Builder Class

The AnimationModifier.Builder provides a fluent API for constructing modifiers.

Builder Methods

predicate(BooleanSupplier)

Sets the predicate condition. The predicate is automatically throttled to tick rate.

start(int)

Sets the lerp-in time in ticks.

end(int)

Sets the lerp-out time in ticks.

type(AnimationIterator.Type)

Sets the animation loop type.

speed(float)

Sets a constant speed modifier.

speed(FloatSupplier)

Sets a dynamic speed modifier. The supplier is automatically throttled to tick rate.

override(Boolean)

Sets whether this animation should override others.

player(PlatformPlayer)

Sets the target player for this animation.

mergeNotDefault(AnimationModifier)

Merges non-default values from another modifier into this builder.

build()

Constructs the AnimationModifier instance.

Usage Examples

Basic Animation with Lerp

Conditional Animation with Speed

Play Once Animation

Dynamic Speed Based on Game State

Override Existing Animations

Merging Modifiers

See Also