fix: optimize avatar expansion and collapse animation duration for improved responsiveness in ProfileScreen
This commit is contained in:
@@ -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"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user