Progressive blur
Create progressive blur effect
Alpha-masked progressive blur
Modifier.drawPlainBackdrop(
backdrop = backdrop,
shape = { RectangleShape },
effects = {
blur(4f.dp.toPx())
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
effect(
RenderEffect.createRuntimeShaderEffect(
obtainRuntimeShader(
"AlphaMask",
"""
uniform shader content;
uniform float2 size;
layout(color) uniform half4 tint;
uniform float tintIntensity;
half4 main(float2 coord) {
float blurAlpha = smoothstep(size.y, size.y * 0.5, coord.y);
float tintAlpha = smoothstep(size.y, size.y * 0.5, coord.y);
return mix(content.eval(coord) * blurAlpha, tint * tintAlpha, tintIntensity);
}"""
).apply {
setFloatUniform("size", size.width, size.height)
setColorUniform("tint", tintColor.toArgb())
setFloatUniform("tintIntensity", 0.8f)
},
"content"
)
)
}
}
)Exact progressive blur
Last updated