Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JetPack Compose accompanist Pager lerp not found

I'm learning accompanist pager and I want to set effect on the pager.

I want to use the lerp method like the document

Modifier.graphicsLayer {
    // Calculate the absolute offset for the current page from the
    // scroll position. We use the absolute value which allows us 
    // to mirror any effects for both directions
    val pageOffset = 
        calculateCurrentOffsetForPage(page).absoluteValue

    // We animate the scaleX + scaleY, between 85% and 100%
    lerp(
      start = 0.85f,
      stop = 1f,
      fraction = 1f - pageOffset.coerceIn(0f, 1f)).also { scale ->
        scaleX = scale
        scaleY = scale
      }

    // We animate the alpha, between 50% and 100%
    alpha = lerp(
      start = 0.5f,
      stop = 1f,
      fraction = 1f - pageOffset.coerceIn(0f, 1f)
                                )

but I can't find the right import for the lerp method for animating the scale like documentation. any suggestions are welcome

like image 488
MohammadBaqer Avatar asked Dec 02 '25 04:12

MohammadBaqer


1 Answers

I faced this issue. The issue solved after add this dependency:

implementation "androidx.compose.ui:ui-util:$compose_version"

like image 129
Enes Zor Avatar answered Dec 04 '25 20:12

Enes Zor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!