fix: optimize avatar expansion and collapse animation duration for improved responsiveness in ProfileScreen

This commit is contained in:
2026-02-01 15:33:41 +05:00
parent 6d15a34512
commit 5b983b4a89
2 changed files with 35 additions and 28 deletions

View File

@@ -339,18 +339,19 @@ fun ProfileScreen(
}
// Telegram: duration = (1 - value) * 250ms при expand, value * 250ms при collapse
// Но минимизируем для мгновенного отклика
val currentProgress = (overscrollOffset / maxOverscroll).coerceIn(0f, 1f)
val snapDuration = if (targetOverscroll == maxOverscroll) {
((1f - currentProgress) * 250).toInt().coerceIn(100, 300)
((1f - currentProgress) * 150).toInt().coerceIn(50, 150) // Рост - быстро!
} else {
(currentProgress * 250).toInt().coerceIn(100, 300)
(currentProgress * 150).toInt().coerceIn(50, 150) // Коллапс - тоже быстро!
}
val animatedOverscroll by animateFloatAsState(
targetValue = targetOverscroll,
animationSpec = tween(
durationMillis = if (isDragging) 0 else snapDuration,
easing = FastOutSlowInEasing // Telegram: CubicBezierInterpolator.EASE_BOTH
easing = LinearOutSlowInEasing // Быстрый старт, плавное завершение
),
label = "overscroll"
)