Skip to content

Commit 5f99bd3

Browse files
committed
iOS: fix gym timer jitter and position jump
- Ring no longer stutters: it updated ~33x/sec but had a 0.1s animation, so each update fought the previous one. Removed the animation so it tracks smoothly. - Clock no longer jumps when the ROUND row appears: reserve a fixed-height area for it so the layout never reflows between countdown and work. - Zero-pad the clock to MM:SS so the centered number keeps constant width across minute rollovers (also reads like a proper digital wall clock). Calmed the number transition from a spring to an eased fade.
1 parent 94e1a9c commit 5f99bd3

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

ios/OpenProgression/Features/Timer/GymTimerView.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,22 @@ struct GymTimerView: View {
4848
Circle().trim(from: 0, to: t.segProgress)
4949
.stroke(color, style: StrokeStyle(lineWidth: 12, lineCap: .round))
5050
.rotationEffect(.degrees(-90))
51-
.animation(.linear(duration: 0.1), value: t.segProgress)
5251
Text(fmt(t.big))
5352
.font(.system(size: 92, weight: .black, design: .rounded)).monospacedDigit()
5453
.foregroundStyle(color)
5554
.contentTransition(.numericText(countsDown: !t.isCountUp))
56-
.animation(.snappy, value: t.big)
55+
.animation(.easeInOut(duration: 0.18), value: t.big)
5756
}
5857
.frame(width: 300, height: 300).padding(.vertical, 24)
59-
.scaleEffect(pulse ? 1.04 : 1.0)
58+
.scaleEffect(pulse ? 1.05 : 1.0)
6059
.animation(.easeInOut(duration: 0.45).repeatForever(autoreverses: true), value: pulse)
61-
if let r = t.roundsLabel {
62-
Text("ROUND \(r)").font(.display(18, .bold)).foregroundStyle(Theme.text)
63-
if t.totalRounds <= 12 { roundDots }
64-
}
60+
// Reserve a fixed-height row so the clock never shifts when ROUND appears.
61+
VStack(spacing: 6) {
62+
if let r = t.roundsLabel {
63+
Text("ROUND \(r)").font(.display(18, .bold)).foregroundStyle(Theme.text)
64+
if t.totalRounds <= 12 { roundDots }
65+
}
66+
}.frame(height: 56)
6567
Spacer()
6668
controls
6769
}
@@ -161,5 +163,5 @@ struct GymTimerView: View {
161163
}.buttonStyle(.pressable)
162164
}
163165

164-
private func fmt(_ s: Int) -> String { String(format: "%d:%02d", s / 60, s % 60) }
166+
private func fmt(_ s: Int) -> String { String(format: "%02d:%02d", s / 60, s % 60) }
165167
}

0 commit comments

Comments
 (0)