animateScrollTo

suspend fun ScrollState.animateScrollTo(x: Int = this.x, y: Int = this.y, animationSpec: AnimationSpec<Point> = spring(visibilityThreshold = pointVisibilityThreshold()))

Scrolls the pane to x, y over time, a step per frame, and returns once it arrives.

A caller that means one axis names one: state.animateScrollTo(y = state.maxY). It takes over the position, and is ended and throws, as ScrollState.scroll does. Each frame's position is coerced to the content's current bounds while a pane renders this state. Launch from rememberCoroutineScope() or another scope on the Event Dispatch Thread.

Parameters

x

the view coordinate to show at the viewport's left edge; where the pane stands at this call by default.

y

the view coordinate to show at the viewport's top edge; where the pane stands at this call by default.

animationSpec

how the position travels, a spring that arrives within one unit on each axis by default.

See also