title: Reset offset animation on draggable item in Jetpack Compose
body: <p>I have a green square that I can drag vertically. But whenever I stop dragging it, I want it to reset the offset to the start with an animation. I tried it like this, but I can't figure it out. Does someone know how to do it?</p>
  <pre><code>@Composable
  fun DraggableSquare() {
      var currentOffset by remember { mutableStateOf(0F) }
      val resetAnimation by animateIntOffsetAsState(targetValue = IntOffset(0, currentOffset.roundToInt()))
  
      var shouldReset = false
  
      Box(contentAlignment = Alignment.TopCenter, modifier = Modifier.fillMaxSize()) {
          Surface(
              color = Color(0xFF34AB52),
              modifier = Modifier
                  .size(100.dp)
                  .offset {
                      when {
                          shouldReset -&gt; resetAnimation
                          else -&gt; IntOffset(0, currentOffset.roundToInt())
                      }
                  }
                  .draggable(
                      state = rememberDraggableState { delta -&gt; currentOffset += delta },
                      orientation = Orientation.Vertical,
                      onDragStopped = {
                          shouldReset = true
                          currentOffset = 0F
                      }
                  )
          ) {}
      }
  }
  </code></pre>