latestest state. almost there
This commit is contained in:
parent
cf5610ea26
commit
8a5a248628
@ -61,8 +61,11 @@ open class LoadingSpinner: View {
|
||||
}
|
||||
|
||||
struct Pose {
|
||||
/// Delayed time (in seconds) to execute after the previous Pose.
|
||||
let delay: CFTimeInterval
|
||||
/// The time into the animation to begin.
|
||||
let start: CGFloat
|
||||
/// The length of the drawn line.
|
||||
let length: CGFloat
|
||||
}
|
||||
|
||||
@ -70,6 +73,7 @@ open class LoadingSpinner: View {
|
||||
class var poses: [Pose] {
|
||||
get {
|
||||
return [
|
||||
// Pose(delay: 0.0, start: 1.250, length: 0.7),
|
||||
Pose(delay: 0.0, start: 0.000, length: 0.7),
|
||||
Pose(delay: 0.7, start: 0.500, length: 0.5),
|
||||
Pose(delay: 0.6, start: 1.000, length: 0.3),
|
||||
@ -78,29 +82,19 @@ open class LoadingSpinner: View {
|
||||
Pose(delay: 0.3, start: 2.250, length: 0.3),
|
||||
Pose(delay: 0.2, start: 2.600, length: 0.5),
|
||||
Pose(delay: 0.2, start: 3.000, length: 0.7)
|
||||
|
||||
// Pose(delay: 0.0, start: 0.000, length: 0.75),
|
||||
// Pose(delay: 0.7, start: 0.500, length: 0.55),
|
||||
// Pose(delay: 0.5, start: 1.000, length: 0.35),
|
||||
// Pose(delay: 0.4, start: 1.500, length: 0.4),
|
||||
// Pose(delay: 0.3, start: 1.875, length: 0.25),
|
||||
// Pose(delay: 0.3, start: 2.250, length: 0.4),
|
||||
// Pose(delay: 0.4, start: 2.600, length: 0.55),
|
||||
// Pose(delay: 0.4, start: 3.000, length: 0.7)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// I like this
|
||||
// Pose(delay: 0.0, start: 0.000, length: 0.75),
|
||||
// Pose(delay: 0.7, start: 0.500, length: 0.55),
|
||||
// Pose(delay: 0.5, start: 1.000, length: 0.35),
|
||||
// Pose(delay: 0.4, start: 1.500, length: 0.4),
|
||||
// Pose(delay: 0.3, start: 1.875, length: 0.25),
|
||||
// Pose(delay: 0.3, start: 2.250, length: 0.4),
|
||||
// Pose(delay: 0.4, start: 2.600, length: 0.55),
|
||||
// Pose(delay: 0.4, start: 3.000, length: 0.7)
|
||||
|
||||
// Pose(delay: 0.0, start: 0.000, length: 0.7),
|
||||
// Pose(delay: 0.7, start: 0.500, length: 0.5),
|
||||
// Pose(delay: 0.6, start: 1.000, length: 0.3),
|
||||
// Pose(delay: 0.5, start: 1.500, length: 0.2),
|
||||
// Pose(delay: 0.4, start: 1.875, length: 0.2),
|
||||
// Pose(delay: 0.3, start: 2.250, length: 0.3),
|
||||
// Pose(delay: 0.2, start: 2.600, length: 0.5),
|
||||
// Pose(delay: 0.2, start: 3.000, length: 0.7)
|
||||
|
||||
private func animate() {
|
||||
var time: CFTimeInterval = 0
|
||||
var times = [CFTimeInterval]()
|
||||
@ -119,10 +113,6 @@ open class LoadingSpinner: View {
|
||||
strokeEnds.append(pose.length)
|
||||
}
|
||||
|
||||
// times.append(times.last ?? 1)
|
||||
// rotations.append(rotations[0])
|
||||
// strokeEnds.append(strokeEnds[0])
|
||||
|
||||
animateKeyPath(keyPath: "strokeEnd", duration: totalSeconds, times: times, values: strokeEnds)
|
||||
animateKeyPath(keyPath: "transform.rotation", duration: totalSeconds, times: times, values: rotations)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user