style(android): improve idle background
This commit is contained in:
@@ -5,10 +5,13 @@ import androidx.compose.animation.core.animateFloat
|
|||||||
import androidx.compose.animation.core.infiniteRepeatable
|
import androidx.compose.animation.core.infiniteRepeatable
|
||||||
import androidx.compose.animation.core.rememberInfiniteTransition
|
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.Canvas
|
import androidx.compose.foundation.Canvas
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.blur
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.graphics.BlendMode
|
import androidx.compose.ui.graphics.BlendMode
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
@@ -49,9 +52,8 @@ fun ClawdisIdleBackground(modifier: Modifier = Modifier) {
|
|||||||
label = "glowY",
|
label = "glowY",
|
||||||
).value
|
).value
|
||||||
|
|
||||||
Canvas(modifier = modifier.fillMaxSize()) {
|
Box(modifier = modifier.fillMaxSize().background(Color.Black)) {
|
||||||
drawRect(Color.Black)
|
Canvas(modifier = Modifier.fillMaxSize()) {
|
||||||
|
|
||||||
val w = size.width
|
val w = size.width
|
||||||
val h = size.height
|
val h = size.height
|
||||||
|
|
||||||
@@ -89,9 +91,21 @@ fun ClawdisIdleBackground(modifier: Modifier = Modifier) {
|
|||||||
y += spacing
|
y += spacing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Glow drift layer (approximation of iOS WebView scaffold).
|
// Glow drift layer (closer to iOS WebView scaffold: blur + screen blend).
|
||||||
|
Canvas(modifier = Modifier.fillMaxSize().blur(28.dp)) {
|
||||||
|
val w = size.width
|
||||||
|
val h = size.height
|
||||||
val glowOffset = Offset(glowX.dp.toPx(), glowY.dp.toPx())
|
val glowOffset = Offset(glowX.dp.toPx(), glowY.dp.toPx())
|
||||||
|
|
||||||
|
fun radial(cx: Float, cy: Float, r: Float, color: Color): Brush =
|
||||||
|
Brush.radialGradient(
|
||||||
|
colors = listOf(color, Color.Transparent),
|
||||||
|
center = Offset(cx, cy),
|
||||||
|
radius = r,
|
||||||
|
)
|
||||||
|
|
||||||
drawRect(
|
drawRect(
|
||||||
brush = radial(w * 0.30f + glowOffset.x, h * 0.30f + glowOffset.y, r = maxOf(w, h) * 0.75f, color = Color(0xFF2A71FF).copy(alpha = 0.16f)),
|
brush = radial(w * 0.30f + glowOffset.x, h * 0.30f + glowOffset.y, r = maxOf(w, h) * 0.75f, color = Color(0xFF2A71FF).copy(alpha = 0.16f)),
|
||||||
blendMode = BlendMode.Screen,
|
blendMode = BlendMode.Screen,
|
||||||
@@ -109,4 +123,4 @@ fun ClawdisIdleBackground(modifier: Modifier = Modifier) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user