perf: 年视图/BottomCard alpha+offset → graphicsLayer
- YearGridView crossFadeAlpha: alpha() → graphicsLayer(年视图翻页淡入淡出) - BottomCard slideProgress: offset()+alpha() → graphicsLayer(年视图切换滑出) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
55000f64c9
commit
297a7a54d4
@ -19,6 +19,7 @@ import androidx.compose.animation.slideInVertically
|
|||||||
import androidx.compose.animation.slideOutVertically
|
import androidx.compose.animation.slideOutVertically
|
||||||
import androidx.compose.animation.togetherWith
|
import androidx.compose.animation.togetherWith
|
||||||
import androidx.compose.ui.graphics.TransformOrigin
|
import androidx.compose.ui.graphics.TransformOrigin
|
||||||
|
import androidx.compose.ui.graphics.graphicsLayer
|
||||||
import androidx.compose.foundation.Canvas
|
import androidx.compose.foundation.Canvas
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
@ -309,7 +310,7 @@ fun CalendarMonthView(
|
|||||||
},
|
},
|
||||||
sharedTransitionScope = sharedScope,
|
sharedTransitionScope = sharedScope,
|
||||||
animatedVisibilityScope = this@AnimatedContent,
|
animatedVisibilityScope = this@AnimatedContent,
|
||||||
modifier = Modifier.alpha(crossFadeAlpha)
|
modifier = Modifier.graphicsLayer { this.alpha = crossFadeAlpha }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -570,6 +571,7 @@ private fun BottomCardArea(
|
|||||||
animationSpec = tween(350, delayMillis = 100, easing = FastOutSlowInEasing),
|
animationSpec = tween(350, delayMillis = 100, easing = FastOutSlowInEasing),
|
||||||
label = "bottomCardSlide"
|
label = "bottomCardSlide"
|
||||||
)
|
)
|
||||||
|
val slideOffsetY = with(density) { (slideProgress * 200).dp.toPx() }
|
||||||
|
|
||||||
// 延迟一帧显示 BottomCard,避免 AnimatedGif 和 lunar 计算阻塞首帧
|
// 延迟一帧显示 BottomCard,避免 AnimatedGif 和 lunar 计算阻塞首帧
|
||||||
var hasLoaded by remember { mutableStateOf(false) }
|
var hasLoaded by remember { mutableStateOf(false) }
|
||||||
@ -594,8 +596,10 @@ private fun BottomCardArea(
|
|||||||
onExpandDragEnd = { viewModel.onExpandDragEnd() },
|
onExpandDragEnd = { viewModel.onExpandDragEnd() },
|
||||||
dragRangePx = dragRangePx,
|
dragRangePx = dragRangePx,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.offset(y = with(density) { (slideProgress * 200).dp })
|
.graphicsLayer {
|
||||||
.alpha(1f - slideProgress)
|
translationY = slideOffsetY
|
||||||
|
this.alpha = 1f - slideProgress
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user