Function

snapTo

Snap to a targetValue without any animation.

snapTo

Source set: Android
public suspend fun snapTo(targetValue: T)

Snap to a targetValue without any animation. If the targetValue is not in the set of anchors, the currentValue will be updated to the targetValue without updating the offset.

Parameters

targetValue The target value of the animation

Throws: CancellationException

if the interaction is interrupted by another interaction like a gesture interaction or another programmatic interaction like an animateTo or snapTo call.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: