Skip to content
AKarda-kazancimainbrew()
Personal blog
AK
arda-kazanci › journal ›progressive-blur-jetpack-compose-four-patterns.md
← Journal.md
progressive-blur-jetpack-compose-four-patterns.md228 lines · Markdown · UTF-8
Markdown Preview · progressive-blur-jetpack-compose-four-patterns.md Rendered
journal/progressive-blur-jetpack-compose-four-patterns.md

Progressive Blur in Jetpack Compose 1.13: Four Interactive Patterns Worth Shipping

A hands-on look at BlurRadiusSpec and the Modifier.blur { } block in Compose UI 1.13: a hero title horizon, a paywall teaser, a radial focus lens, and a depth carousel, all animated without recomposition.

When I covered the new graphics APIs in Compose 1.13, progressive blur got a single paragraph and one GIF of floating circles. That was enough to show the API exists. It wasn’t enough to answer the question I actually care about: where does this belong in a real product UI?

So I built a small “Blur Lab” inside my news reader app and tried four patterns I see designers ask for again and again. Every one of them is interactive, every one of them animates, and none of them needs an AGSL shader.

Before the patterns, a quick refresher on what changed.

Uniform blur vs. progressive blur

Modifier.blur(radius) has been around since Android 12. It applies one radius to the whole composable, which is great for frosted placeholders and not much else.

Compose UI 1.13 adds BlurRadiusSpec. The radius can now change across the surface: vertically, horizontally, along an angle, or outward from a point. You can also pass up to 16 BlurStops for multi-stage transitions.

The design value is subtle but real. A scrim suppresses content. Blur removes detail but keeps color and atmosphere. Progressive blur does that without drawing a hard line, so the sharp part and the soft part feel like one image.

Setup

Progressive blur ships in androidx.compose.ui:ui 1.13. I bumped the Compose BOM:

gradle/libs.versions.toml
[versions]
composeBom = "2026.11.01"

One thing caught me off guard: the first build failed in checkDebugAarMetadata. Compose 1.13 artifacts require compiling against Android API 37.1. On AGP 9 that’s a minor API level:

app/build.gradle.kts
android {
compileSdk {
version = release(37) {
minorApiLevel = 1
}
}
}

targetSdk doesn’t need to change.

The one rule: read animated values inside the block

There are two ways to apply a progressive blur. You can pass a BlurRadiusSpec directly, or you can use the configuration block:

Snippet.kt
Modifier.blur {
blurRadiusSpec = BlurRadiusSpec.verticalGradient(0.dp, 12.dp)
}

The block runs during the graphics layer phase, after measure and layout. If you read an animated value inside it, Compose only pushes a new RenderEffect to the existing layer. No recomposition, and the content display list isn’t re-recorded.

That’s why every preset below takes its animated inputs as lambdas:

BlurModifiers.kt
fun Modifier.horizonBlur(
horizon: () -> Float,
maxRadius: Dp = 28.dp,
feather: Float = 0.25f,
): Modifier = this.blur {
val start = horizon().coerceIn(0f, 0.95f)
val end = (start + feather).coerceAtMost(1f)
blurRadiusSpec = BlurRadiusSpec.verticalGradient(
stops = listOf(
BlurStop(fraction = 0f, radius = 0.dp),
BlurStop(fraction = start, radius = 0.dp),
BlurStop(fraction = end, radius = maxRadius),
BlurStop(fraction = 1f, radius = maxRadius),
),
)
}

The BlurScope receiver also gives you size in Dp and implements Density, so gradient geometry can depend on the layer size without any extra plumbing.

Pattern 1: Hero horizon

Hero Horizon demo: a mountain photo that stays sharp at the top and blurs softly toward the headline at the bottom

The problem: white text on a busy photo. The usual fix is a black gradient scrim, which works but makes every hero image look like it was shot at dusk.

The pattern: keep the top of the image crisp and let it melt into blur exactly where the headline sits. The photo keeps its colors, and the title gets a calm surface to land on.

In the demo, the blur rises from the bottom edge on entry with a low-bouncy spring. Dragging vertically moves the “horizon”, and a thin guide line fades in while your finger is down:

HeroHorizonDemo.kt
val horizon = remember { Animatable(1f) }
LaunchedEffect(Unit) {
horizon.animateTo(
targetValue = 0.55f,
animationSpec = spring(Spring.DampingRatioLowBouncy, Spring.StiffnessVeryLow),
)
}
LabImage(
photo = photo,
modifier = Modifier
.fillMaxSize()
.horizonBlur(horizon = { horizon.value }),
)

Note that I still keep a light scrim under the caption. Blur alone doesn’t guarantee contrast. A bright, blurred sky behind white text is still unreadable. Blur makes the scrim look better; it doesn’t replace it.

Pattern 2: Locked article

Locked Article demo: the article starts readable and becomes progressively blurred toward a Keep reading with Premium card

The problem: the classic paywall fade (text to white) tells the reader “something ends here”. It doesn’t tell them how much is left.

The pattern: the first paragraph is readable, then the text slowly loses focus. You can still see the shape of the paragraphs underneath, which signals that real content is waiting.

The interesting part is the unlock animation. A single lock value from 1f to 0f does two things at once: it pushes the sharp area down, and it lowers the maximum radius. The blur looks like it’s melting off the page:

BlurModifiers.kt
fun Modifier.revealBlur(
lock: () -> Float,
maxRadius: Dp = 16.dp,
): Modifier = this.blur {
val amount = lock().coerceIn(0f, 1f)
if ((maxRadius * amount) < NoBlurThreshold) return@blur
val sharpUntil = lerp(start = 0.95f, stop = 0.30f, fraction = amount)
blurRadiusSpec = BlurRadiusSpec.verticalGradient(
stops = listOf(
BlurStop(fraction = 0f, radius = 0.dp),
BlurStop(fraction = sharpUntil, radius = 0.dp),
BlurStop(fraction = 1f, radius = maxRadius * amount),
),
)
}

The early return@blur matters. If the block never assigns blurRadiusSpec, it stays at the default uniform zero, and Compose clears the layer’s RenderEffect instead of creating a useless one.

Pattern 3: Focus lens

Focus Lens demo: a fjord photo where only a small circle around the touch point is sharp, everything else is blurred

The problem: you want to direct attention to one spot (an onboarding hint, a product detail, a map pin) without covering the rest of the screen with a dark overlay.

The pattern: a camera-style shallow depth of field. A small core stays sharp and blur builds up as you move away from it.

radialGradient takes a center and a fallOffRadius. I store the focal point as a fraction of the layer size, so the same value works on any screen and maps cleanly to BlurScope.size:

BlurModifiers.kt
fun Modifier.focusBlur(
focus: () -> Offset,
lensRadius: () -> Dp,
sharpCore: Float = 0.35f,
maxRadius: Dp = 24.dp,
): Modifier = this.blur {
val point = focus()
blurRadiusSpec = BlurRadiusSpec.radialGradient(
stops = listOf(
BlurStop(fraction = 0f, radius = 0.dp),
BlurStop(fraction = sharpCore, radius = 0.dp),
BlurStop(fraction = 1f, radius = maxRadius),
),
center = DpOffset(x = size.width * point.x, y = size.height * point.y),
fallOffRadius = lensRadius().coerceAtLeast(1.dp),
)
}

Tapping springs the focus to a new spot, dragging makes it follow your finger, and a double tap animates the lens between a compact and a wide size. Both the focal point and the lens radius are Animatables, and both are only read inside the blur block and a drawBehind ring. Dragging the focus around never recomposes the screen; only the layer and the ring are redrawn.

Depth Carousel demo: the center card is sharp, the next card peeks in from the right with its outer edge blurred, over an ambient blurred backdrop

The problem: carousels with peeking side cards often feel flat. Scaling the side cards down helps, but they still compete with the selected one.

The pattern: as a card moves away from the center, its outer edge loses focus. The left card blurs on its left side, the right card on its right side. It reads like a lens with shallow depth of field.

The pager’s signed page offset drives the direction and the strength:

BlurModifiers.kt
fun Modifier.depthBlur(
pageOffset: () -> Float,
shape: Shape,
maxRadius: Dp = 18.dp,
): Modifier = this.blur {
val offset = pageOffset().coerceIn(-1f, 1f)
val radius = maxRadius * offset.absoluteValue
if (radius < NoBlurThreshold) return@blur
blurRadiusSpec = if (offset > 0f) {
BlurRadiusSpec.horizontalGradient(startRadius = radius, endRadius = 0.dp)
} else {
BlurRadiusSpec.horizontalGradient(startRadius = 0.dp, endRadius = radius)
}
edgeTreatment = BlurredEdgeTreatment(shape)
}
DepthCarouselDemo.kt
HorizontalPager(state = pagerState, contentPadding = PaddingValues(horizontal = 56.dp)) { page ->
DepthCard(
photo = photos[page],
pageOffset = { (pagerState.currentPage - page) + pagerState.currentPageOffsetFraction },
)
}

The backdrop is the one place I used the old uniform Modifier.blur(60.dp). It’s a heavily blurred copy of the current card that crossfades when the pager settles, so the whole screen picks up the card’s color.

What progressive blur can’t do

A few things worth knowing before you pitch this to your designer:

  • It’s a surface blur, not a backdrop blur. Modifier.blur blurs the composable’s own content. The iOS-style frosted app bar over scrolling content needs a different approach, so don’t promise it from this API.
  • Android 13 (API 33)+ only. Uniform blur needs API 31, gradients need API 33. On older devices the content draws sharp. Design the fallback first: the scrim should keep the UI readable on its own.
  • Spatially varying radii are capped at 150 px. uniform has no cap.
  • Each blurred composable gets its own layer. Three pager cards are fine. Every item in a long LazyColumn probably isn’t, so profile first.
  • Create BlurRadiusSpec.shader once. Each call returns a configuration that never compares equal, which defeats caching. Mutate the shader’s uniforms instead.

Wrapping up

What surprised me most is how small each pattern ended up. The blur logic for all four demos fits in about 100 lines of modifiers, and the screens themselves are mostly layout. The real work is the design decision: what should be sharp, what should fade, and what the user’s finger should control.

If you try one of these patterns in production, start with the hero horizon. It’s the easiest win, it degrades gracefully on older devices, and nobody will miss the black gradient.

Written with AI assistance. Ideas, code, demos, and final review by Arda Kazancı.

SHARE ENTRYLinkedIn ↗X ↗Markdown / AI ↗
Discussions ardakazanci/blog-comments
● GiscusView discussions on GitHub ↗
⑂Reactions & comments/ Sign in with GitHub to react or join the discussion.
Notifications Newsletter · beehiiv
✓ Active channelSubscribe directly ↗
✉Get new posts by email/ Android, Kotlin, and Compose notes. Straight to your inbox.

SUBSCRIPTION CONFIG · EMAIL DISPATCH

Stay synced with new entries

Receive practical engineering notes on Android architecture, Kotlin, and Jetpack Compose whenever a new article is published.

channel = "email"spam = falseunsubscribe = "anytime"
K subscriber.propertiesEmail address