{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

SnapSpec

public final class SnapSpec<T extends Object> implements DurationBasedAnimationSpec


SnapSpec describes a jump-cut type of animation. It immediately snaps the animating value to the end value.

Summary

Public constructors

<T extends Object> SnapSpec(int delay)

Public methods

boolean
equals(Object other)
final int

the amount of time (in milliseconds) that the animation should wait before it starts.

int
@NonNull VectorizedDurationBasedAnimationSpec<@NonNull V>
<V extends AnimationVector> vectorize(
    @NonNull TwoWayConverter<@NonNull T, @NonNull V> converter
)

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

Public constructors

SnapSpec

public <T extends Object> SnapSpec(int delay)
Parameters
int delay

the amount of time (in milliseconds) that the animation should wait before it starts. Defaults to 0.

Public methods

equals

public boolean equals(Object other)

getDelay

public final int getDelay()

the amount of time (in milliseconds) that the animation should wait before it starts. Defaults to 0.

hashCode

public int hashCode()

vectorize

public @NonNull VectorizedDurationBasedAnimationSpec<@NonNull V> <V extends AnimationVector> vectorize(
    @NonNull TwoWayConverter<@NonNull T, @NonNull V> converter
)

Creates a VectorizedAnimationSpec with the given TwoWayConverter.

The underlying animation system operates on AnimationVectors. T will be converted to AnimationVector to animate. VectorizedAnimationSpec describes how the converted AnimationVector should be animated. E.g. The animation could simply interpolate between the start and end values (i.e.TweenSpec), or apply spring physics to produce the motion (i.e. SpringSpec), etc)

Parameters
@NonNull TwoWayConverter<@NonNull T, @NonNull V> converter

converts the type T from and to AnimationVector type