fix(ui): remove incorrect blur from sphere Canvas to restore razor-sharp edges and solid crystal glass definition

This commit is contained in:
Bruno Deanoz 2026-06-18 17:01:28 +02:00
parent b03f1773fe
commit 7b012d1041

View file

@ -180,6 +180,7 @@ fun KaizenOrb(
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
// --- LAYER 1: Ambient Outer Halo (Subtle larger glow) --- // --- LAYER 1: Ambient Outer Halo (Subtle larger glow) ---
// This is the ONLY layer that is blurred, providing a soft background glow.
Box( Box(
Modifier Modifier
.size(size * 1.5f) .size(size * 1.5f)
@ -198,33 +199,45 @@ fun KaizenOrb(
) )
// --- LAYER 2: Glass Sphere body with refracted backgrounds & conic caustics --- // --- LAYER 2: Glass Sphere body with refracted backgrounds & conic caustics ---
// DRAWN PERFECTLY SHARP (No blur modifier on the Canvas!) to ensure razor-sharp,
// solid circular boundaries that give the orb its heavy, crystal-glass volume.
Canvas( Canvas(
modifier = Modifier modifier = Modifier.fillMaxSize()
.fillMaxSize()
.blur(
radius = if (size <= 40.dp) 8.dp else 24.dp,
edgeTreatment = BlurredEdgeTreatment.Unbounded
)
) { ) {
val w = size.toPx() val w = size.toPx()
val h = size.toPx() val h = size.toPx()
val radius = w / 2f val radius = w / 2f
// Shift centers slightly in direction of gravity to simulate holographic refractive parallax // Shift centers slightly in direction of gravity to simulate holographic refractive parallax
val centerShiftX = -tiltX * 0.15f * w val centerShiftX = -tiltX * 0.12f * w
val centerShiftY = tiltY * 0.15f * h val centerShiftY = tiltY * 0.12f * h
val baseGradientCenter = Offset(w * 0.25f + centerShiftX, h * 0.20f + centerShiftY)
// 1. Base Gradient Fill (Refraction glow matching active theme) // 1. Base Gradient Fill (Refraction glow matching active theme)
val baseGradientCenter = Offset(w * 0.35f + centerShiftX, h * 0.30f + centerShiftY)
drawCircle( drawCircle(
brush = Brush.radialGradient( brush = Brush.radialGradient(
colorStops = arrayOf( colorStops = arrayOf(
0.0f to Color.White.copy(alpha = if (isDark) 0.18f else 0.40f), 0.0f to Color(0xFFFFF1D6), // Ultra bright glowing cream-white core
0.55f to Amber.copy(alpha = 0.22f), 0.35f to Color(0xFFFFCC80), // Rich luminous warm amber
1.0f to AmberDeep.copy(alpha = if (isDark) 0.55f else 0.15f) 0.75f to AmberDeep, // Saturated golden amber
1.0f to Color(0xFF8D4F00) // Deep bronze-amber shadow edge (creates high contrast!)
), ),
center = baseGradientCenter, center = baseGradientCenter,
radius = radius * 1.2f radius = radius * 1.1f
)
)
// 2. Heavy 3D Inner Volume Shadow (Sphere Bottom Shading)
// Adds massive physical 3D weight by darkening the sphere's lower edge.
drawCircle(
brush = Brush.radialGradient(
colorStops = arrayOf(
0.0f to Color.Transparent,
0.5f to Color.Transparent,
1.0f to Color(0xFF4A2300).copy(alpha = 0.85f) // Deep dark brown shadow edge
),
center = Offset(w * 0.35f + centerShiftX, h * 0.30f + centerShiftY),
radius = radius * 1.0f
) )
) )
@ -233,14 +246,14 @@ fun KaizenOrb(
val coreShiftY = -tiltY * 0.05f * h val coreShiftY = -tiltY * 0.05f * h
val coreCenter = Offset(w / 2f + coreShiftX, h / 2f + coreShiftY) val coreCenter = Offset(w / 2f + coreShiftX, h / 2f + coreShiftY)
// 2. Conic Caustic Layer #1 (SweepGradient at 30° blended via BlendMode.Overlay) // 3. Conic Caustic Layer #1 (SweepGradient at 30° blended via BlendMode.Overlay)
val sweepBrush1 = Brush.sweepGradient( val sweepBrush1 = Brush.sweepGradient(
colorStops = arrayOf( colorStops = arrayOf(
0.0f to Color.Transparent, 0.0f to Color.Transparent,
0.16f to Amber.copy(alpha = 0.35f), 0.16f to Amber.copy(alpha = 0.65f),
0.33f to Color.White.copy(alpha = 0.25f), 0.33f to Color.White.copy(alpha = 0.55f),
0.50f to Color.Transparent, 0.50f to Color.Transparent,
0.66f to AmberDeep.copy(alpha = 0.30f), 0.66f to AmberDeep.copy(alpha = 0.50f),
1.0f to Color.Transparent 1.0f to Color.Transparent
), ),
center = coreCenter center = coreCenter
@ -251,13 +264,13 @@ fun KaizenOrb(
blendMode = BlendMode.Overlay blendMode = BlendMode.Overlay
) )
// 3. Conic Caustic Layer #2 (Secondary parallax SweepGradient at 200° via BlendMode.Softlight) // 4. Conic Caustic Layer #2 (Secondary parallax SweepGradient at 200° via BlendMode.Softlight)
val sweepBrush2 = Brush.sweepGradient( val sweepBrush2 = Brush.sweepGradient(
colorStops = arrayOf( colorStops = arrayOf(
0.0f to Color.Transparent, 0.0f to Color.Transparent,
0.25f to Color.White.copy(alpha = 0.20f), 0.25f to Color.White.copy(alpha = 0.40f),
0.50f to Color.Transparent, 0.50f to Color.Transparent,
0.75f to Amber.copy(alpha = 0.25f), 0.75f to Amber.copy(alpha = 0.50f),
1.0f to Color.Transparent 1.0f to Color.Transparent
), ),
center = coreCenter center = coreCenter
@ -269,7 +282,7 @@ fun KaizenOrb(
) )
} }
// --- LAYER 3: Specular Highlights & Crisp Rim --- // --- LAYER 3: Specular Highlights & Crisp Rim (Sharp reflections) ---
Canvas(modifier = Modifier.fillMaxSize()) { Canvas(modifier = Modifier.fillMaxSize()) {
val w = size.toPx() val w = size.toPx()
val h = size.toPx() val h = size.toPx()
@ -281,36 +294,32 @@ fun KaizenOrb(
val specularCenter1 = Offset(w * 0.28f + specularShiftX, h * 0.22f + specularShiftY) val specularCenter1 = Offset(w * 0.28f + specularShiftX, h * 0.22f + specularShiftY)
val specularCenter2 = Offset(w * 0.70f + specularShiftX, h * 0.82f + specularShiftY) val specularCenter2 = Offset(w * 0.70f + specularShiftX, h * 0.82f + specularShiftY)
// 1. Primary "wet" gloss highlight (top-left) // 1. Primary "wet" gloss highlight (top-left) - extremely bright, solid, and sharp!
drawCircle( drawCircle(
brush = Brush.radialGradient( brush = Brush.radialGradient(
colors = listOf(Color.White.copy(alpha = 0.95f), Color.Transparent), colors = listOf(Color.White, Color.Transparent),
center = specularCenter1, center = specularCenter1,
radius = radius * 0.45f radius = radius * 0.38f
) )
) )
// 2. Secondary ambient bounce highlight (bottom-right) // 2. Secondary ambient bounce highlight (bottom-right edge glow)
drawCircle( drawCircle(
brush = Brush.radialGradient( brush = Brush.radialGradient(
colors = listOf( colors = listOf(
if (isDark) { Color(0xFFFFD180).copy(alpha = 0.80f), // Bright warm amber light refraction
Amber.copy(alpha = 0.40f)
} else {
Color.White.copy(alpha = 0.40f)
},
Color.Transparent Color.Transparent
), ),
center = specularCenter2, center = specularCenter2,
radius = radius * 0.30f radius = radius * 0.28f
) )
) )
// 3. Ultra-sharp outer rim (1px hairline highlight for crystal reflection) // 3. Ultra-sharp outer rim (1px hairline highlight for crisp crystal reflection)
drawCircle( drawCircle(
color = Color.White.copy(alpha = if (isDark) 0.12f else 0.45f), color = Color.White.copy(alpha = if (isDark) 0.12f else 0.45f),
radius = radius - 0.5f, radius = radius - 0.5f,
style = Stroke(width = 1f) style = Stroke(width = 1.5f)
) )
} }
} }