Back to Snippets 
Shake Animation for UI Components in Jetpack Compose
This Jetpack Compose function, ShakeContent, applies a shaking effect to its composable child when the shake parameter is true. It uses animateFloatAsState with a repeatable animation to shift the content back and forth along the X-axis. The animation consists of three iterations with a short duration, creating a smooth shaking motion. This can be useful for error indications or interactive UI feedback.
UIAnimation

Click to expand preview
Scroll for source code