Jetpack Compose Bubble Animation

Jetpack Compose Bubble Animation

This is a Compose-based animation that displays bubbles of different sizes moving around the screen.

BubbleAnimation.mp4

Usage

To use the animation, you can call the BubbleAnimation() composable function and pass in the following parameters:

  • colors: a list of Color objects representing the gradient colors of the bubbles.
  • bubbleCount: an integer value representing the number of bubbles to display.
  • offsetX: a float value representing the maximum horizontal distance a bubble can move.
  • offsetY: a float value representing the maximum vertical distance a bubble can moves.
BubbleAnimation(
    listOf(Color.Yellow, Color.Gray),
    bubbleCount = 13,
    offsetX = 900f,
    offsetY = 750f,
)

Preview

You can preview the animation using the BubbleAnimationPreview() composable function:

@Preview(showBackground = true)
@Composable
fun BubbleAnimationPreview() {
    BubbleAnimation(
        listOf(Color.Yellow,Color.Gray),
        bubbleCount = 13,
        offsetX = 900f,
        offsetY = 750f
    )
}

GitHub

View Github

Leave a Reply

Your email address will not be published. Required fields are marked *