File tree Expand file tree Collapse file tree
app/src/main/java/com/better/nothing/music/vizualizer/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -486,25 +486,28 @@ internal fun BetterVizApp(
486486 userScrollEnabled = true
487487 ) { page ->
488488 val tab = Tab .entries[page]
489- val pageOffset =
490- ((pagerState.currentPage - page) + pagerState.currentPageOffsetFraction).absoluteValue
491-
489+ val pageOffset = (pagerState.currentPage - page) + pagerState.currentPageOffsetFraction
492490 Box (
493491 modifier = Modifier
494492 .fillMaxSize()
495493 .graphicsLayer {
496- val fraction = 1f - pageOffset.coerceIn(0f , 1f )
494+ // 1. Get the absolute offset so scrolling left or right yields the same fraction amount
495+ val absOffset = pageOffset.coerceIn(- 1f , 1f ).let { kotlin.math.abs(it) }
496+
497+ // 2. Calculate the fraction using the absolute offset (0f to 1f)
498+ val fraction = 1f - absOffset
499+
497500 val scale = 0.8f + (1f - 0.8f ) * fraction
498501 scaleX = scale
499502 scaleY = scale
500503 alpha = fraction * fraction
501504
502- // Calculate rotation: 0 deg when fully visible, 20 deg when hidden
505+ // 3. Calculate rotation: 0 deg when fully visible, 20 deg when hidden
503506 val maxRotation = 10f
504507 val rotationAmount = maxRotation * (1f - fraction)
505508
506- // Use the sign of pageOffset to determine +20 or -20
507- rotationZ = if (pageOffset > 0 ) rotationAmount else - rotationAmount
509+ // 4. Use the original pageOffset sign to choose +20 or -20
510+ rotationZ = if (pageOffset > 0 ) - rotationAmount else rotationAmount
508511 }
509512 ) {
510513 when (tab) {
Original file line number Diff line number Diff line change @@ -548,7 +548,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
548548 return flat?.contains(ctx.packageName) == true
549549 }
550550
551- var lastStatsSyncMs = 0L
552551
553552 val _devPassword = MutableStateFlow <String ?>(null )
554553
You can’t perform that action at this time.
0 commit comments