🎬 恢复进度动画 (0.2s),value变化时平滑过渡,布局变化时瞬间响应
This commit is contained in:
parent
794e23a178
commit
d463189e39
@ -66,6 +66,7 @@ struct StyledGauge: View {
|
||||
)
|
||||
)
|
||||
.frame(width: max(geo.size.width * CGFloat(value / 100), 4), height: 8)
|
||||
.animation(.easeOut(duration: 0.2), value: value)
|
||||
}
|
||||
}
|
||||
.frame(height: 8)
|
||||
@ -91,6 +92,7 @@ struct StyledGauge: View {
|
||||
Circle()
|
||||
.stroke(Color.white.opacity(0.12), lineWidth: 5)
|
||||
.frame(width: 48, height: 48)
|
||||
.animation(.easeOut(duration: 0.2), value: value)
|
||||
Circle()
|
||||
.trim(from: 0, to: CGFloat(value / 100))
|
||||
.stroke(
|
||||
@ -127,6 +129,7 @@ struct StyledGauge: View {
|
||||
Text(String(format: "%.1f%@", value, unit))
|
||||
.font(.system(size: fontSize + 6, weight: .bold, design: .monospaced))
|
||||
.foregroundColor(gaugeColor)
|
||||
.animation(.easeOut(duration: 0.2), value: value)
|
||||
Spacer()
|
||||
Text(detail)
|
||||
.font(.system(size: fontSize - 2))
|
||||
@ -148,6 +151,7 @@ struct StyledGauge: View {
|
||||
.fill(gaugeColor.opacity(0.85))
|
||||
.frame(width: 42, height: 42)
|
||||
.clipShape(Circle())
|
||||
.animation(.easeOut(duration: 0.2), value: value)
|
||||
|
||||
Text(String(format: "%.0f", value))
|
||||
.font(.system(size: fontSize - 2, weight: .bold, design: .monospaced))
|
||||
@ -178,6 +182,7 @@ struct StyledGauge: View {
|
||||
RoundedRectangle(cornerRadius: 4)
|
||||
.fill(gaugeColor)
|
||||
.frame(width: max(geo.size.width * CGFloat(value / 100), 3), height: 14)
|
||||
.animation(.easeOut(duration: 0.2), value: value)
|
||||
}
|
||||
}
|
||||
.frame(height: 14)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user