A lightweight, customizable, animated wavy background composable for Jetpack Compose. Perfect for headers, footers, sections, onboarding screens, and aesthetic UI elements.
- β Crest-touching waves (top or bottom)
- β Smooth infinite horizontal wave motion
- β Optional breathing vertical animation
- β Auto-scales for any height (even 1.dp)
- β Zero clipping / zero cut-outs
- β
Easy presets (
WaveStyle) - β Highly customizable
- β No dependencies
- β MIT license
Just copy these files into your project:
waves/
βββ com/jaikeerthick/waves/
βββ WavyBackground.kt
βββ WaveDirection.kt
βββ WaveStyle.kt
βββ WavePreviews.kt
No setup required. No Gradle configuration. No library installation.
WavyBackground(
modifier = Modifier
.fillMaxWidth()
.height(180.dp),
color = Color(0xFF4FC3F7)
)WavyBackground(
modifier = Modifier
.fillMaxWidth()
.height(150.dp),
waveDirection = WaveDirection.Top,
color = Color(0xFF80DEEA)
)WavyBackground(
modifier = Modifier
.fillMaxWidth()
.height(150.dp),
waveDirection = WaveDirection.Bottom,
color = Color(0xFF26C6DA)
)WavyBackground(
style = WaveStyle.Calm
)| Style | Description |
|---|---|
| Calm | Slow, soft, minimal movement |
| Gentle | Balanced, default preset |
| Energetic | Fast-moving, deeper waves |
WavyBackground(
waveCount = 7,
waveAmplitude = 24.dp,
waveSpeed = 900f,
verticalOscillationSpeed = 1400f,
reverseDirection = true,
animateWaveShape = true
)| Name | Description |
|---|---|
waveDirection |
Top or Bottom |
waveCount |
Number of waves across the width |
waveAmplitude |
Height of the wave crests/troughs |
waveSpeed |
Duration (ms) for a full horizontal loop |
verticalOscillationSpeed |
Speed of breathing animation |
reverseDirection |
Reverse horizontal motion |
animateWaveShape |
Enable/disable breathing effect |
To preview waves in Android Studio:
@Preview
@Composable
fun PreviewWaves() {
WavyBackground(
modifier = Modifier
.fillMaxWidth()
.height(180.dp),
style = WaveStyle.Gentle
)
}- Uses a Canvas & trigonometric BΓ©zier-like curve drawing
- Ensures the crest touches the edge cleanly
- Auto-scales based on the composable height
- Smooth per-frame animation using
withFrameMillis - Fully optimized β no allocations per frame
Pull requests are welcome! Here are great ways to contribute:
- New wave presets
- Additional wave shapes (multi-layer waves?)
- Theming support
- Performance improvements
- Documentation improvements
If this helped you, consider giving the repo a star β β it motivates continued updates!
This project is licensed under the terms of the MIT License.
See the full license here: LICENSE
MIT License
Copyright (c) 2025
