Top Description Inners Fields Constructors Methods
io.github.kusoroadeolu.clique.configuration

public final Class EasingConfiguration

extends Object
Class Inheritance
Annotations
@Stable
since:3.2.0
Imports
io.github.kusoroadeolu.clique.internal.documentation.InternalApi, .Stable, java.util.Objects

Immutable configuration controlling the easing animation applied during animated progress bar ticks.

Easing interpolates a tick across multiple rendered frames over a fixed duration, producing a smooth animation rather than an instant jump. Whether easing is applied to a given tick is determined by shouldEase(int), which compares the tick amount against the configured threshold. The default values are:

Default values:

The per-frame delay is derived from durationMs / frames and is available via getFrameDelayMs().

This class is immutable and thread-safe. EasingConfigurationBuilder is not thread-safe.

Example:

EasingConfiguration easing = EasingConfiguration.builder()
    .function(EasingFunction.EASE_IN_OUT_CUBIC)
    .duration(300)
    .frames(15)
    .threshold(10)
    .build();
Since
3.0.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final EasingConfiguration
DEFAULT

A default EasingConfiguration with EASE_OUT_QUAD, 500 ms duration, 20 frames, and a threshold of 5.

public static final EasingConfiguration
DISABLED

A disabled EasingConfiguration.

private static final int
private final int
private final int
private final EasingFunction
private final int

Constructor Summary

AccessConstructor and Description
private
private

Method Summary

Modifier and TypeMethod and Description
public static EasingConfiguration.EasingConfigurationBuilder
builder()

Returns a new builder for constructing an EasingConfiguration.

private static EasingConfiguration
public boolean
equals(Object object)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int

Returns:

the animation duration in milliseconds; >= 0
getDurationMs
()

Returns the total duration of the easing animation in milliseconds.

public long

Returns:

the per-frame delay in milliseconds
getFrameDelayMs
()

Returns the delay between each animation frame, derived as durationMs / frames.

public int

Returns:

the frame count; always >= 1
getFrames
()

Returns the number of intermediate frames rendered during the animation.

public EasingFunction

Returns:

the easing function; never null
getFunction
()

Returns the easing function applied to interpolate progress across frames.

public int

Returns:

the threshold; >= 0
getThreshold
()

Returns the minimum tick amount required to trigger easing.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean

Returns:

true if easing should be applied; false otherwise
shouldEase
(int
the number of ticks being advanced
tickBy
)

Returns whether easing should be applied for the given tick amount.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

DEFAULTback to summary
public static final EasingConfiguration DEFAULT

A default EasingConfiguration with EASE_OUT_QUAD, 500 ms duration, 20 frames, and a threshold of 5.

DISABLEDback to summary
public static final EasingConfiguration DISABLED

A disabled EasingConfiguration. shouldEase(int) always returns false, causing all ticks to be applied instantly without animation.

DISABLED_THRESHOLDback to summary
private static final int DISABLED_THRESHOLD
durationMsback to summary
private final int durationMs
framesback to summary
private final int frames
functionback to summary
private final EasingFunction function
thresholdback to summary
private final int threshold

Constructor Detail

EasingConfigurationback to summary
private EasingConfiguration()
EasingConfigurationback to summary
private EasingConfiguration(EasingConfiguration.EasingConfigurationBuilder easingConfigurationBuilder)

Method Detail

builderback to summary
public static EasingConfiguration.EasingConfigurationBuilder builder()

Returns a new builder for constructing an EasingConfiguration.

Returns:EasingConfiguration.EasingConfigurationBuilder

a new EasingConfigurationBuilder

disabledConfigback to summary
private static EasingConfiguration disabledConfig()
equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

getDurationMsback to summary
public int getDurationMs()

Returns the total duration of the easing animation in milliseconds.

The per-frame delay is durationMs / frames, available via getFrameDelayMs().

Returns:int

the animation duration in milliseconds; >= 0

getFrameDelayMsback to summary
public long getFrameDelayMs()

Returns the delay between each animation frame, derived as durationMs / frames.

Returns:long

the per-frame delay in milliseconds

getFramesback to summary
public int getFrames()

Returns the number of intermediate frames rendered during the animation.

Higher values produce smoother animations at the cost of increased CPU usage. The per-frame delay is durationMs / frames.

Returns:int

the frame count; always >= 1

getFunctionback to summary
public EasingFunction getFunction()

Returns the easing function applied to interpolate progress across frames.

Returns:EasingFunction

the easing function; never null

getThresholdback to summary
public int getThreshold()

Returns the minimum tick amount required to trigger easing.

Ticks below this value are applied instantly. A threshold of 0 means easing is applied to all ticks. See shouldEase(int).

Returns:int

the threshold; >= 0

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
shouldEaseback to summary
public boolean shouldEase(int tickBy)

Returns whether easing should be applied for the given tick amount.

Returns true if tickBy >= threshold and threshold >= 0. If threshold < 0, this method always returns false, effectively disabling easing regardless of tick size.

Parameters
tickBy:int

the number of ticks being advanced

Returns:boolean

true if easing should be applied; false otherwise

Annotations
@InternalApi
since:4.0.2
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
io.github.kusoroadeolu.clique.configuration back to summary

public Class EasingConfiguration.EasingConfigurationBuilder

extends Object
Class Inheritance
  • java.lang.Object
  • io.github.kusoroadeolu.clique.configuration.EasingConfiguration.EasingConfigurationBuilder

Builder for EasingConfiguration.

This builder is not thread-safe.

Field Summary

Modifier and TypeField and Description
private int
private int
private EasingFunction
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public EasingConfiguration

Returns:

a new, immutable EasingConfiguration
build
()

Constructs a new EasingConfiguration from the current builder state.

public EasingConfiguration.EasingConfigurationBuilder

Returns:

this builder
duration
(int
the animation duration; must be >= 0
durationMs
)

Sets the total duration of the easing animation in milliseconds.

public EasingConfiguration.EasingConfigurationBuilder

Returns:

this builder
frames
(int
the number of frames; must be >= 1
frames
)

Sets the number of intermediate frames rendered during the animation.

public EasingConfiguration.EasingConfigurationBuilder

Returns:

this builder
function
(EasingFunction
the easing function to apply; must not be null
function
)

Sets the easing function used to interpolate progress across frames.

public EasingConfiguration.EasingConfigurationBuilder

Returns:

this builder
threshold
(int
the minimum tick amount; must be >= 0
threshold
)

Sets the minimum tick amount required to trigger easing.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

durationMsback to summary
private int durationMs
framesback to summary
private int frames
functionback to summary
private EasingFunction function
thresholdback to summary
private int threshold

Constructor Detail

EasingConfigurationBuilderback to summary
public EasingConfigurationBuilder()

Method Detail

buildback to summary
public EasingConfiguration build()

Constructs a new EasingConfiguration from the current builder state.

Returns:EasingConfiguration

a new, immutable EasingConfiguration

durationback to summary
public EasingConfiguration.EasingConfigurationBuilder duration(int durationMs)

Sets the total duration of the easing animation in milliseconds.

The per-frame delay is computed as durationMs / frames. A duration of 0 causes all frames to render without delay.

Parameters
durationMs:int

the animation duration; must be >= 0

Returns:EasingConfiguration.EasingConfigurationBuilder

this builder

Exceptions
IllegalArgumentException:
if durationMs is negative
framesback to summary
public EasingConfiguration.EasingConfigurationBuilder frames(int frames)

Sets the number of intermediate frames rendered during the animation.

Higher values produce smoother animations at the cost of increased CPU usage. The per-frame delay is computed as durationMs / frames.

Parameters
frames:int

the number of frames; must be >= 1

Returns:EasingConfiguration.EasingConfigurationBuilder

this builder

Exceptions
IllegalArgumentException:
if frames is <= 0
functionback to summary
public EasingConfiguration.EasingConfigurationBuilder function(EasingFunction function)

Sets the easing function used to interpolate progress across frames.

Parameters
function:EasingFunction

the easing function to apply; must not be null

Returns:EasingConfiguration.EasingConfigurationBuilder

this builder

Exceptions
NullPointerException:
if function is null
thresholdback to summary
public EasingConfiguration.EasingConfigurationBuilder threshold(int threshold)

Sets the minimum tick amount required to trigger easing.

Ticks smaller than this value are applied instantly without animation. Set to 0 to ease all ticks regardless of size.

Parameters
threshold:int

the minimum tick amount; must be >= 0

Returns:EasingConfiguration.EasingConfigurationBuilder

this builder

Exceptions
IllegalArgumentException:
if threshold is negative