Initial commit: rosetta-android-prime
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
package com.rosetta.messenger.ui.splash
|
||||
|
||||
import androidx.compose.animation.core.*
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.rosetta.messenger.R
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
@Composable
|
||||
fun SplashScreen(
|
||||
isDarkTheme: Boolean,
|
||||
onSplashComplete: () -> Unit
|
||||
) {
|
||||
val backgroundColor = if (isDarkTheme) Color(0xFF1B1B1B) else Color.White
|
||||
|
||||
// Animation states
|
||||
var startAnimation by remember { mutableStateOf(false) }
|
||||
|
||||
val scale by animateFloatAsState(
|
||||
targetValue = if (startAnimation) 1f else 0f,
|
||||
animationSpec = spring(
|
||||
dampingRatio = 0.5f,
|
||||
stiffness = Spring.StiffnessLow
|
||||
),
|
||||
label = "scale"
|
||||
)
|
||||
|
||||
val pulseScale by rememberInfiniteTransition(label = "pulse").animateFloat(
|
||||
initialValue = 1f,
|
||||
targetValue = 1.1f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(800, easing = FastOutSlowInEasing),
|
||||
repeatMode = RepeatMode.Reverse
|
||||
),
|
||||
label = "pulseScale"
|
||||
)
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
startAnimation = true
|
||||
delay(2000) // Show splash for 2 seconds
|
||||
onSplashComplete()
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(backgroundColor),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
// Glow effect behind logo
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(180.dp)
|
||||
.scale(scale * pulseScale)
|
||||
.background(
|
||||
color = Color(0xFF54A9EB).copy(alpha = 0.2f),
|
||||
shape = CircleShape
|
||||
)
|
||||
)
|
||||
|
||||
// Main logo
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.rosetta_icon),
|
||||
contentDescription = "Rosetta Logo",
|
||||
modifier = Modifier
|
||||
.size(150.dp)
|
||||
.scale(scale)
|
||||
.clip(CircleShape)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user