perf(ui): 恢复数字滚动并优化曲线与圆环连续动效

This commit is contained in:
2026-11-04 14:04:05 +08:00
parent f18f6652ff
commit 44f0415ab7
12 changed files with 394 additions and 144 deletions
+12 -3
View File
@@ -7,15 +7,24 @@ struct AnimatedMetricText: View {
var body: some View {
if animates {
Text(verbatim: value).monospacedDigit()
.contentTransition(.opacity)
.animation(.easeInOut(duration: MetricMotion.duration), value: value)
RollingMetricText(value: value).equatable()
} else {
Text(verbatim: value).monospacedDigit()
}
}
}
/// Same numeric roll/blur and spring as the original implementation. Unchanged values
/// do not rebuild this subtree when the surrounding resource snapshot changes.
private struct RollingMetricText: View, Equatable {
let value: String
var body: some View {
Text(verbatim: value).monospacedDigit()
.contentTransition(.numericText())
.animation(.spring(duration: 0.35, bounce: 0), value: value)
}
}
struct PanelCardBackground: ViewModifier {
let radius: CGFloat