26 lines
743 B
Swift
26 lines
743 B
Swift
import SwiftUI
|
|
|
|
/// Short numeric transitions follow the owner-supplied motion policy.
|
|
struct AnimatedMetricText: View {
|
|
let value: String
|
|
@Environment(\.metricAnimationsEnabled) private var animates
|
|
|
|
var body: some View {
|
|
if animates {
|
|
Text(verbatim: value).monospacedDigit()
|
|
.contentTransition(.opacity)
|
|
.animation(.easeInOut(duration: MetricMotion.duration), value: value)
|
|
} else {
|
|
Text(verbatim: value).monospacedDigit()
|
|
}
|
|
}
|
|
}
|
|
|
|
struct PanelCardBackground: ViewModifier {
|
|
let radius: CGFloat
|
|
|
|
func body(content: Content) -> some View {
|
|
content.background(RoundedRectangle(cornerRadius: radius).fill(Color("PanelCard")))
|
|
}
|
|
}
|