Customize the click animation on Compose UI
First, create a state to trigger the animation from start to end. there using the function pointerInput to detect the gestures: Modifier . pointerInput ( key1 = this ) { // block awaitPointerEventScope { while ( true ) { buttonState = if (buttonState == ButtonState. Pressed ) { waitForUpOrCancellation(PointerEventPass. Initial ) ButtonState. Idle } else { awaitFirstDown( true ) ButtonState. Pressed } } } } - key1 is a value that involves the `block` that should be re-executed when its content changes. (and the previous `block` will be canceled.) - when we set the `this` keyword as key1 variable, we suppose to know this `block` executed once only. - inside the ` awaitPointerEventScope `, we should run a while loop always to prevent leaving this code. - awaitFirstDown is a suspend fu