title: How to animate image using HorizantalPager?
body: <p>I have three backgrounds in Box and that box contains HorizontalPager and a Image Component which changes according to HorizontalPager Current page but there is no animation how to added animation like this<br>
  <a href="https://cdn.dribbble.com/users/1588664/screenshots/8257559/media/d94b36cb7822008df8055c90ca6e2238.mp4" rel="nofollow noreferrer">https://cdn.dribbble.com/users/1588664/screenshots/8257559/media/d94b36cb7822008df8055c90ca6e2238.mp4</a></p>
  <p>And here is my code preview
  <a href="https://drive.google.com/file/d/1i2ix1Xdx-TK2SVPgx8MhFZWfqQnhZcr5/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1i2ix1Xdx-TK2SVPgx8MhFZWfqQnhZcr5/view?usp=sharing</a></p>
  <pre><code>val pagerState = rememberPagerState(pageCount = 3)
  val currentIndex = pagerState.currentPage
  val currentPageOffset = pagerState.currentPageOffset
  val poster = listOf(
      R.drawable.red,R.drawable.blue,R.drawable.green
  )
  Box(modifier = Modifier.fillMaxSize()){
      Image(
          painter = painterResource(poster[currentIndex]),
          contentDescription = null,
          contentScale = ContentScale.FillWidth,
          modifier = Modifier.fillMaxWidth()
      )
      HorizontalPager(
          state = pagerState,
          modifier = Modifier.fillMaxSize()
      ) { page -&gt;
          val maxOffset = 70.dp
          val offset = maxOffset * when (page) {
              currentIndex -&gt; {
                  currentPageOffset.absoluteValue
              }
              currentIndex - 1 -&gt; {
                  1 + currentPageOffset.coerceAtMost(0f)
              }
              currentIndex + 1 -&gt; {
                  1 - currentPageOffset.coerceAtLeast(0f)
              }
              else -&gt; {
                  1f
              }
          }
          Card(
              modifier = Modifier
                  .fillMaxWidth(0.7f)
                  .fillMaxHeight(0.7f)
                  .padding(22.dp)
                  .offset(y = offset),
              shape = RoundedCornerShape(30.dp),
              elevation = 110.dp
          ) {}
      }
  }
  </code></pre>