|
@@ -19,6 +19,14 @@ func magnitude(of range: Range<Double>) -> Double {
|
|
return range.upperBound - range.lowerBound
|
|
return range.upperBound - range.lowerBound
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+extension Animation{
|
|
|
|
+ static func ripple(index: Int) -> Animation{
|
|
|
|
+ Animation.spring(dampingFraction: 0.5)
|
|
|
|
+ .speed(2)
|
|
|
|
+ .delay(0.03 * Double(index))
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
struct HikeGraph: View {
|
|
struct HikeGraph: View {
|
|
var hike: Hike
|
|
var hike: Hike
|
|
var path: KeyPath<Hike.Observation, Range<Double>>
|
|
var path: KeyPath<Hike.Observation, Range<Double>>
|
|
@@ -51,6 +59,8 @@ struct HikeGraph: View {
|
|
range: data[index][keyPath: self.path],
|
|
range: data[index][keyPath: self.path],
|
|
overallRange: overallRange)
|
|
overallRange: overallRange)
|
|
.colorMultiply(self.color)
|
|
.colorMultiply(self.color)
|
|
|
|
+ .transition(.slide)
|
|
|
|
+ .animation(.ripple(index: index))
|
|
}
|
|
}
|
|
.offset(x: 0, y: proxy.size.height * heightRatio)
|
|
.offset(x: 0, y: proxy.size.height * heightRatio)
|
|
}
|
|
}
|