Update lens
This commit is contained in:
1 parent
a11b1f4c31
commit
e096ea868b
7 files changed
+11
-11
No files matched your search
@@ -12,9 +12,9 @@ import com.kyant.backdrop.RoundedRectRefractionWithDispersionShaderString
|
||||
|
||||
fun BackdropEffectScope.lens(
|
||||
refractionHeight: Float,
|
||||
refractionAmount: Float = refractionHeight,
|
||||
hasDepthEffect: Boolean = false,
|
||||
chromaticAberration: Offset = Offset.Zero
|
||||
refractionAmount: Float,
|
||||
chromaticAberration: Offset = Offset.Zero,
|
||||
depthEffect: Boolean = false
|
||||
) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return
|
||||
if (refractionHeight <= 0f || refractionAmount <= 0f) return
|
||||
@@ -29,7 +29,7 @@ fun BackdropEffectScope.lens(
|
||||
setFloatUniform("cornerRadii", cornerRadii)
|
||||
setFloatUniform("refractionHeight", refractionHeight)
|
||||
setFloatUniform("refractionAmount", -refractionAmount)
|
||||
setFloatUniform("depthEffect", if (hasDepthEffect) 1f else 0f)
|
||||
setFloatUniform("depthEffect", if (depthEffect) 1f else 0f)
|
||||
}
|
||||
} else {
|
||||
obtainRuntimeShader(
|
||||
@@ -40,7 +40,7 @@ fun BackdropEffectScope.lens(
|
||||
setFloatUniform("cornerRadii", cornerRadii)
|
||||
setFloatUniform("refractionHeight", refractionHeight)
|
||||
setFloatUniform("refractionAmount", -refractionAmount)
|
||||
setFloatUniform("depthEffect", if (hasDepthEffect) 1f else 0f)
|
||||
setFloatUniform("depthEffect", if (depthEffect) 1f else 0f)
|
||||
setFloatUniform("chromaticAberration", chromaticAberration.x, chromaticAberration.y)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ fun AdaptiveLuminanceGlassContent() {
|
||||
if (l > 0f) lerp(8f.dp.toPx(), 16f.dp.toPx(), l)
|
||||
else lerp(8f.dp.toPx(), 2f.dp.toPx(), -l)
|
||||
)
|
||||
lens(24f.dp.toPx(), size.minDimension / 2f, true)
|
||||
lens(24f.dp.toPx(), size.minDimension / 2f, depthEffect = true)
|
||||
},
|
||||
layerBlock = {
|
||||
val offset = offsetAnimation.value
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ fun ControlCenterContent() {
|
||||
lens(
|
||||
24f.dp.toPx() * progress,
|
||||
48f.dp.toPx() * progress,
|
||||
true
|
||||
depthEffect = true
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ fun DialogContent() {
|
||||
saturation = 1.5f
|
||||
)
|
||||
blur(if (isLightTheme) 16f.dp.toPx() else 8f.dp.toPx())
|
||||
lens(24f.dp.toPx(), 48f.dp.toPx(), true)
|
||||
lens(24f.dp.toPx(), 48f.dp.toPx(), depthEffect = true)
|
||||
},
|
||||
onDrawSurface = { drawRect(containerColor) }
|
||||
)
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ fun GlassPlaygroundContent() {
|
||||
lens(
|
||||
refractionHeight = refractionHeightFrac * minDimension * 0.5f,
|
||||
refractionAmount = refractionAmountFrac * minDimension,
|
||||
hasDepthEffect = true,
|
||||
depthEffect = true,
|
||||
chromaticAberration = Offset(chromaticAberration, chromaticAberration)
|
||||
)
|
||||
},
|
||||
|
||||
@@ -54,7 +54,7 @@ fun LockScreenContent() {
|
||||
effects = {
|
||||
vibrancy()
|
||||
blur(4f.dp.toPx())
|
||||
lens(12f.dp.toPx(), 24f.dp.toPx(), true)
|
||||
lens(12f.dp.toPx(), 24f.dp.toPx(), depthEffect = true)
|
||||
},
|
||||
onDrawSurface = { drawRect(Color.White.copy(0.1f)) },
|
||||
contentEffects = {
|
||||
|
||||
@@ -89,7 +89,7 @@ fun MagnifierContent() {
|
||||
lens(
|
||||
8f.dp.toPx(),
|
||||
24f.dp.toPx(),
|
||||
hasDepthEffect = true,
|
||||
depthEffect = true,
|
||||
chromaticAberration = DefaultChromaticAberration
|
||||
)
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user