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