feat(settings): 默认启用短动效并提供独立减弱动画选项
This commit is contained in:
@@ -4,6 +4,7 @@ import SwiftUI
|
||||
struct MetricProgressBar: View {
|
||||
let value: Double
|
||||
let color: Color
|
||||
@Environment(\.metricAnimationsEnabled) private var animates
|
||||
|
||||
private var fraction: Double { value.isFinite ? min(1, max(0, value)) : 0 }
|
||||
|
||||
@@ -15,6 +16,8 @@ struct MetricProgressBar: View {
|
||||
}
|
||||
.frame(width: proxy.size.width, height: proxy.size.height)
|
||||
.clipShape(Capsule())
|
||||
.animation(animates ? .easeInOut(duration: MetricMotion.duration) : nil, value: fraction)
|
||||
.transaction { if !animates { $0.disablesAnimations = true } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user