fix: fix ImageEditorScreen animation smoothness
This commit is contained in:
@@ -150,12 +150,15 @@ fun ImageEditorScreen(
|
||||
var isClosing by remember { mutableStateOf(false) }
|
||||
val animationProgress = remember { Animatable(0f) }
|
||||
|
||||
// 🎬 Плавный easing для fade-out (как в Telegram)
|
||||
val smoothEasing = CubicBezierEasing(0.4f, 0.0f, 0.2f, 1.0f)
|
||||
|
||||
// Запуск enter анимации
|
||||
LaunchedEffect(Unit) {
|
||||
animationProgress.animateTo(
|
||||
targetValue = 1f,
|
||||
animationSpec = tween(
|
||||
durationMillis = 200,
|
||||
durationMillis = 250,
|
||||
easing = FastOutSlowInEasing
|
||||
)
|
||||
)
|
||||
@@ -198,8 +201,8 @@ fun ImageEditorScreen(
|
||||
animationProgress.animateTo(
|
||||
targetValue = 0f,
|
||||
animationSpec = tween(
|
||||
durationMillis = 200,
|
||||
easing = FastOutSlowInEasing
|
||||
durationMillis = 350, // 🎬 Более плавное закрытие
|
||||
easing = smoothEasing
|
||||
)
|
||||
)
|
||||
onDismiss()
|
||||
@@ -353,8 +356,8 @@ fun ImageEditorScreen(
|
||||
// Альфа фона
|
||||
animatedBackgroundAlpha = progress
|
||||
} else {
|
||||
// Fallback анимация без позиции
|
||||
animatedScale = 0.95f + 0.05f * progress
|
||||
// ⚡ Простой fade - только opacity, без scale
|
||||
animatedScale = 1f
|
||||
animatedTranslationX = 0f
|
||||
animatedTranslationY = 0f
|
||||
animatedCornerRadius = 0f
|
||||
@@ -365,13 +368,8 @@ fun ImageEditorScreen(
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color.Black.copy(alpha = animatedBackgroundAlpha))
|
||||
.graphicsLayer {
|
||||
scaleX = animatedScale
|
||||
scaleY = animatedScale
|
||||
translationX = animatedTranslationX
|
||||
translationY = animatedTranslationY
|
||||
}
|
||||
.graphicsLayer { alpha = animationProgress.value } // ⚡ Всё плавно fade
|
||||
.background(Color.Black)
|
||||
) {
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// 📸 FULLSCREEN PHOTO - занимает ВЕСЬ экран, не реагирует на клавиатуру
|
||||
@@ -1497,13 +1495,16 @@ fun MultiImageEditorScreen(
|
||||
animationProgress.animateTo(
|
||||
targetValue = 1f,
|
||||
animationSpec = tween(
|
||||
durationMillis = 200,
|
||||
durationMillis = 250,
|
||||
easing = FastOutSlowInEasing
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// Функция для плавного закрытия
|
||||
// 🎬 Плавный easing для fade-out
|
||||
val smoothEasing = CubicBezierEasing(0.4f, 0.0f, 0.2f, 1.0f)
|
||||
|
||||
// Функция для плавного закрытия - простой быстрый fade-out
|
||||
fun animatedDismiss() {
|
||||
if (isClosing) return
|
||||
isClosing = true
|
||||
@@ -1511,8 +1512,8 @@ fun MultiImageEditorScreen(
|
||||
animationProgress.animateTo(
|
||||
targetValue = 0f,
|
||||
animationSpec = tween(
|
||||
durationMillis = 200,
|
||||
easing = FastOutSlowInEasing
|
||||
durationMillis = 150, // ⚡ Быстрый fade-out
|
||||
easing = LinearEasing
|
||||
)
|
||||
)
|
||||
onDismiss()
|
||||
@@ -1597,18 +1598,12 @@ fun MultiImageEditorScreen(
|
||||
|
||||
BackHandler { animatedDismiss() }
|
||||
|
||||
// 🎬 Анимированный контейнер с fade эффектом
|
||||
val progress = animationProgress.value
|
||||
|
||||
// ⚡ Простой fade - только opacity
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color.Black.copy(alpha = progress))
|
||||
.graphicsLayer {
|
||||
alpha = progress
|
||||
scaleX = 0.95f + 0.05f * progress
|
||||
scaleY = 0.95f + 0.05f * progress
|
||||
}
|
||||
.graphicsLayer { alpha = animationProgress.value } // ⚡ Всё плавно fade
|
||||
.background(Color.Black)
|
||||
) {
|
||||
// Pager
|
||||
HorizontalPager(
|
||||
|
||||
Reference in New Issue
Block a user