This commit is contained in:
Kevin G Christiano 2020-05-21 16:21:19 -04:00
parent 898877a051
commit 9803f04a78

View File

@ -44,9 +44,12 @@ open class LoadingSpinner: View {
layer.fillColor = nil
layer.strokeColor = strokeColor.cgColor
layer.lineWidth = lineWidth
layer.lineCap = .butt
layer.lineCap = .round
layer.speed = speed
layer.path = UIBezierPath(ovalIn: bounds.insetBy(dx: lineWidth / 2, dy: lineWidth / 2)).cgPath
let halfWidth = lineWidth / 2
let radius = (bounds.width - lineWidth) / 2
layer.path = UIBezierPath(arcCenter: CGPoint(x: radius + halfWidth, y: radius + halfWidth), radius: radius, startAngle: -CGFloat.pi / 2, endAngle: 2.5 * CGFloat.pi, clockwise: true).cgPath
}
//--------------------------------------------------
@ -79,6 +82,25 @@ open class LoadingSpinner: View {
}
}
// 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]()