I am using this as a value for a path translation,...
# compose
a
I am using this as a value for a path translation, and I don't know why it's not smooth and kinda late.
Copy code
val funnelTranslation by animateFloatAsState(
    targetValue = if (isDeleted.value)
        -radius * 3f - particleRadius
    else
        (offsetX.value - radius * 3f - particleRadius).coerceAtMost(0f)
)
isDeleted is a boolean state, and offsetX is an Animateable. Usage:
Copy code
Box {
    Canvas(
        Modifier.height(imageSizeDp)
    )
    {
        translate(funnelTranslation) {
            drawPath(
                path = drawSideShape(radius = radius, particleRadius = particleRadius * 3 / 4f),
                color = shoesArticle.color
            )
        }
    }
}
a
Put your code in the thread, as per the guidelines
👆 2
d
Can you also share the code for configuring
Animatable
? Looking at the code you currently have, it looks like you are trying to animate to the new offsetX rather than snap to it. If that offsetX is updated by gesture, you'll be spending a few frames animating to where you drag therefore always lagging behind.
a
I don't know where was my mind when I posted this.