perf(ui): 恢复数字滚动并优化曲线与圆环连续动效
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user