JetPack Compose 伴奏者寻呼机 lerp 未找到

Moh*_*qer 18 android kotlin android-jetpack-compose jetpack-compose-accompanist

我正在学习伴奏寻呼机,我想在寻呼机上设置效果。

我想像文档一样使用lerp方法

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)
                                )
Run Code Online (Sandbox Code Playgroud)

但我找不到lerp像文档那样对比例进行动画处理的方法的正确导入。欢迎任何建议

Ene*_*Zor 47

我遇到了这个问题。添加此依赖后问题解决:

实现“androidx.compose.ui:ui-util:$compose_version”