Skip to content

Commit 57c9014

Browse files
committed
Fix begin time
1 parent 9ead1d9 commit 57c9014

7 files changed

+8
-10
lines changed

NVActivityIndicatorViewDemo/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallBeat.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class NVActivityIndicatorAnimationBallBeat: NVActivityIndicatorAnimationDelegate
3838

3939
animation.animations = [scaleAnimation, opacityAnimation]
4040
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
41-
animation.beginTime = beginTime
4241
animation.duration = duration
4342
animation.repeatCount = HUGE
4443
animation.removedOnCompletion = false
@@ -51,7 +50,7 @@ class NVActivityIndicatorAnimationBallBeat: NVActivityIndicatorAnimationDelegate
5150
width: circleSize,
5251
height: circleSize)
5352

54-
animation.beginTime = beginTimes[i]
53+
animation.beginTime = beginTime + beginTimes[i]
5554
circle.frame = frame
5655
circle.addAnimation(animation, forKey: "animation")
5756
layer.addSublayer(circle)

NVActivityIndicatorViewDemo/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class NVActivityIndicatorAnimationBallPulse: NVActivityIndicatorAnimationDelegat
3636
width: circleSize,
3737
height: circleSize)
3838

39-
circle.frame = frame
4039
animation.beginTime = beginTime + beginTimes[i]
40+
circle.frame = frame
4141
circle.addAnimation(animation, forKey: "animation")
4242
layer.addSublayer(circle)
4343
}

NVActivityIndicatorViewDemo/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallPulseSync.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class NVActivityIndicatorAnimationBallPulseSync: NVActivityIndicatorAnimationDel
2626

2727
animation.keyTimes = [0, 0.33, 0.66, 1]
2828
animation.timingFunctions = [timingFunciton, timingFunciton, timingFunciton]
29-
animation.beginTime = beginTime
3029
animation.values = [0, deltaY, -deltaY, 0]
3130
animation.duration = duration
3231
animation.repeatCount = HUGE
@@ -40,7 +39,7 @@ class NVActivityIndicatorAnimationBallPulseSync: NVActivityIndicatorAnimationDel
4039
width: circleSize,
4140
height: circleSize)
4241

43-
animation.beginTime = beginTimes[i]
42+
animation.beginTime = beginTime + beginTimes[i]
4443
circle.frame = frame
4544
circle.addAnimation(animation, forKey: "animation")
4645
layer.addSublayer(circle)

NVActivityIndicatorViewDemo/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationBallScaleMultiple.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class NVActivityIndicatorAnimationBallScaleMultiple: NVActivityIndicatorAnimatio
1212

1313
func setUpAnimationInLayer(layer: CALayer, size: CGSize, color: UIColor) {
1414
let duration: CFTimeInterval = 1
15+
let beginTime = CACurrentMediaTime()
1516
let beginTimes = [0, 0.2, 0.4]
1617

1718
// Scale animation
@@ -45,7 +46,7 @@ class NVActivityIndicatorAnimationBallScaleMultiple: NVActivityIndicatorAnimatio
4546
width: size.width,
4647
height: size.height)
4748

48-
animation.beginTime = beginTimes[i]
49+
animation.beginTime = beginTime + beginTimes[i]
4950
circle.frame = frame
5051
circle.opacity = 0
5152
circle.addAnimation(animation, forKey: "animation")

NVActivityIndicatorViewDemo/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScale.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class NVActivityIndicatorAnimationLineScale: NVActivityIndicatorAnimationDelegat
3434
let line = NVActivityIndicatorShape.Line.createLayerWith(size: CGSize(width: lineSize, height: size.height), color: color)
3535
let frame = CGRect(x: x + lineSize * 2 * CGFloat(i), y: y, width: lineSize, height: size.height)
3636

37-
line.frame = frame
3837
animation.beginTime = beginTime + beginTimes[i]
38+
line.frame = frame
3939
line.addAnimation(animation, forKey: "animation")
4040
layer.addSublayer(line)
4141
}

NVActivityIndicatorViewDemo/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScaleParty.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class NVActivityIndicatorAnimationLineScaleParty: NVActivityIndicatorAnimationDe
2424

2525
animation.keyTimes = [0, 0.5, 1]
2626
animation.timingFunctions = [timingFunction, timingFunction]
27-
animation.beginTime = beginTime
2827
animation.values = [1, 0.5, 1]
2928
animation.repeatCount = HUGE
3029
animation.removedOnCompletion = false
@@ -33,7 +32,7 @@ class NVActivityIndicatorAnimationLineScaleParty: NVActivityIndicatorAnimationDe
3332
let line = NVActivityIndicatorShape.Line.createLayerWith(size: CGSize(width: lineSize, height: size.height), color: color)
3433
let frame = CGRect(x: x + lineSize * 2 * CGFloat(i), y: y, width: lineSize, height: size.height)
3534

36-
animation.beginTime = beginTimes[i]
35+
animation.beginTime = beginTime + beginTimes[i]
3736
animation.duration = durations[i]
3837
line.frame = frame
3938
line.addAnimation(animation, forKey: "animation")

NVActivityIndicatorViewDemo/NVActivityIndicatorView/Animations/NVActivityIndicatorAnimationLineScalePulseOut.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class NVActivityIndicatorAnimationLineScalePulseOut: NVActivityIndicatorAnimatio
1717
let duration: CFTimeInterval = 1
1818
let beginTime = CACurrentMediaTime()
1919
let beginTimes = [0.4, 0.2, 0, 0.2, 0.4]
20-
let timingFunction = CAMediaTimingFunction(controlPoints:0.85, 0.25, 0.37, 0.85)
20+
let timingFunction = CAMediaTimingFunction(controlPoints: 0.85, 0.25, 0.37, 0.85)
2121

2222
// Animation
2323
let animation = CAKeyframeAnimation(keyPath: "transform.scale.y")

0 commit comments

Comments
 (0)