Thread
#compose
    Colton Idle

    Colton Idle

    1 year ago
    I want to add a slideIn and slideOut animation on a
    Image
    , but I want the animation state of the slideIn/Out to be driven by the scrollState of my Column. Is there any way to hook those up to each other?
    Right now I have this sort of thing which actually looks fairly nice, but I'm really trying to drive the sliding to be based off of the scroll state.
    AnimatedVisibility(
        scrollState.value < 1F,
        enter =
            slideIn(
                initialOffset = { fullSize: IntSize ->
                    IntOffset(fullSize.width, fullSize.height)
                }, animationSpec = tween(1500)),
        exit =
            slideOut(
                targetOffset = { fullSize: IntSize ->
                    IntOffset(fullSize.width, fullSize.height)
                }, animationSpec = tween(1500)),
        modifier = Modifier.align(Alignment.BottomEnd)) {
    Essentially I'm trying to build something that is pinned to the bottom right, but peeks out from the corner when you scrolled up, or hides away when you scroll back down.