mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 11:02:12 +03:00
style(android): improve idle background
This commit is contained in:
+19
-5
@@ -5,10 +5,13 @@ import androidx.compose.animation.core.animateFloat
|
||||
import androidx.compose.animation.core.infiniteRepeatable
|
||||
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.blur
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.BlendMode
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
@@ -49,9 +52,8 @@ fun ClawdisIdleBackground(modifier: Modifier = Modifier) {
|
||||
label = "glowY",
|
||||
).value
|
||||
|
||||
Canvas(modifier = modifier.fillMaxSize()) {
|
||||
drawRect(Color.Black)
|
||||
|
||||
Box(modifier = modifier.fillMaxSize().background(Color.Black)) {
|
||||
Canvas(modifier = Modifier.fillMaxSize()) {
|
||||
val w = size.width
|
||||
val h = size.height
|
||||
|
||||
@@ -89,9 +91,21 @@ fun ClawdisIdleBackground(modifier: Modifier = Modifier) {
|
||||
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())
|
||||
|
||||
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(
|
||||
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,
|
||||
@@ -108,5 +122,5 @@ fun ClawdisIdleBackground(modifier: Modifier = Modifier) {
|
||||
alpha = 0.55f,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user