Skip to content

Commit

Permalink
Add Spin animation
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeLin committed May 2, 2015
1 parent 5651289 commit d4c24f0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions iOSAnimationSample/RotationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ class RotationViewController: UIViewController {
// Dispose of any resources that can be recreated.
}

func spin () {
UIView.animateWithDuration(1, delay: 0, options: UIViewAnimationOptions.CurveLinear, animations: {
self.wheel.transform = CGAffineTransformRotate(self.wheel.transform, CGFloat(M_PI))
}) { (finished) -> Void in
self.spin()
}
}

override func viewDidAppear(animated: Bool) {
UIView.animateWithDuration(1, animations: {
self.wheel.transform = CGAffineTransformMakeRotation(CGFloat(M_PI))
})
self.spin()
}

/*
Expand Down

0 comments on commit d4c24f0

Please sign in to comment.