Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions mreader/ReaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8096,19 +8096,21 @@ private struct TranslationProgressPulseStroke: View {
let contour: [CGPoint]
@Environment(\.accessibilityReduceMotion) private var reduceMotion

private let progressColor = Color(red: 0.12, green: 0.58, blue: 1.0)

var body: some View {
Group {
if reduceMotion {
stroke(opacity: 0.24, lineWidth: 1.1)
stroke(opacity: 0.56, lineWidth: 1.35)
} else {
TimelineView(.periodic(from: .now, by: 1.0 / 12.0)) { context in
let duration: TimeInterval = 1.9
let phase = context.date.timeIntervalSinceReferenceDate
.truncatingRemainder(dividingBy: duration) / duration
let pulse = phase <= 0.5 ? phase * 2 : (1 - phase) * 2
stroke(
opacity: 0.16 + pulse * 0.18,
lineWidth: 1.0 + CGFloat(pulse) * 0.25
opacity: 0.38 + pulse * 0.32,
lineWidth: 1.25 + CGFloat(pulse) * 0.40
)
}
}
Expand All @@ -8121,22 +8123,30 @@ private struct TranslationProgressPulseStroke: View {
if contour.count >= 3 {
TranslationBubbleContourShape(points: contour)
.stroke(
Color.secondary.opacity(opacity),
progressColor.opacity(opacity),
style: StrokeStyle(
lineWidth: lineWidth,
lineCap: .round,
lineJoin: .round
)
)
.shadow(
color: progressColor.opacity(opacity * 0.32),
radius: 1.8
)
} else {
RoundedRectangle(
cornerRadius: max(min(layoutSize.width, layoutSize.height) * 0.12, 4),
style: .continuous
)
.stroke(
Color.secondary.opacity(opacity),
progressColor.opacity(opacity),
lineWidth: lineWidth
)
.shadow(
color: progressColor.opacity(opacity * 0.32),
radius: 1.8
)
}
}
}
Expand Down
Loading