Skip to content

Commit d4c24f0

Browse files
committed
Add Spin animation
1 parent 5651289 commit d4c24f0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

iOSAnimationSample/RotationViewController.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ class RotationViewController: UIViewController {
2222
// Dispose of any resources that can be recreated.
2323
}
2424

25+
func spin () {
26+
UIView.animateWithDuration(1, delay: 0, options: UIViewAnimationOptions.CurveLinear, animations: {
27+
self.wheel.transform = CGAffineTransformRotate(self.wheel.transform, CGFloat(M_PI))
28+
}) { (finished) -> Void in
29+
self.spin()
30+
}
31+
}
32+
2533
override func viewDidAppear(animated: Bool) {
26-
UIView.animateWithDuration(1, animations: {
27-
self.wheel.transform = CGAffineTransformMakeRotation(CGFloat(M_PI))
28-
})
34+
self.spin()
2935
}
3036

3137
/*

0 commit comments

Comments
 (0)