Function

animateMoveAlong

Move the mouse along the given curve, sending a stream of move events to get an animated path of durationMillis milliseconds.

mouseInputAnimateMoveAlong

@Sampled
fun mouseInputAnimateMoveAlong() {
    composeTestRule.onNodeWithTag("myComponent").performMouseInput {
        // Hover over the node, making a full circle with a radius of 100px
        val r = 100f
        animateMoveAlong(
            curve = {
                val angle = 2 * PI * it / 1000
                center + Offset(r * cos(angle).toFloat(), r * sin(angle).toFloat())
            },
            durationMillis = 1000L,
        )
    }
}

trackpadInputAnimateMoveAlong

@Sampled
fun trackpadInputAnimateMoveAlong() {
    composeTestRule.onNodeWithTag("myComponent").performTrackpadInput {
        // Hover over the node, making a full circle with a radius of 100px
        val r = 100f
        animateMoveAlong(
            curve = {
                val angle = 2 * PI * it / 1000
                center + Offset(r * cos(angle).toFloat(), r * sin(angle).toFloat())
            },
            durationMillis = 1000L,
        )
    }
}
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: