androidkotlinandroid-jetpack-composejetpack-compose-accompanist

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


Solution

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

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