Commit 80b03f9c by Daniel Dahan

updated MaterialView to better handle UIView animations

parent a3dba3f5
...@@ -40,10 +40,10 @@ class ViewController: UIViewController { ...@@ -40,10 +40,10 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
// prepareFlatButtonExample() prepareFlatButtonExample()
// prepareRaisedButtonExample() prepareRaisedButtonExample()
// prepareFabButtonExample() prepareFabButtonExample()
prepareFabButtonAnimationExample() // prepareFabButtonAnimationExample()
} }
/// General preparation statements. /// General preparation statements.
...@@ -96,9 +96,10 @@ class ViewController: UIViewController { ...@@ -96,9 +96,10 @@ class ViewController: UIViewController {
delay: 3, delay: 3,
usingSpringWithDamping: 0.6, usingSpringWithDamping: 0.6,
initialSpringVelocity: 0, initialSpringVelocity: 0,
options: .AllowUserInteraction, animations: { options: .AllowUserInteraction,
animations: {
button.frame.origin.x = 300 button.frame.origin.x = 300
}, completion: nil) }, completion: nil)
} }
} }
...@@ -41,7 +41,8 @@ class ViewController: UIViewController { ...@@ -41,7 +41,8 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareGeneralMaterialPulseViewExample() // prepareGeneralMaterialPulseViewExample()
prepareMaterialPulseViewAnimationExample()
} }
/// General preparation statements. /// General preparation statements.
...@@ -60,5 +61,28 @@ class ViewController: UIViewController { ...@@ -60,5 +61,28 @@ class ViewController: UIViewController {
// Add pulseView to UIViewController. // Add pulseView to UIViewController.
view.addSubview(pulseView) view.addSubview(pulseView)
} }
/// Prepares the MaterialPulseView animation example.
private func prepareMaterialPulseViewAnimationExample() {
let pulseView: MaterialPulseView = MaterialPulseView(frame: CGRectMake(132, 132, 150, 150))
pulseView.image = UIImage(named: "FocusAppIcon")
pulseView.shape = .Square
pulseView.depth = .Depth2
pulseView.cornerRadius = .Radius3
// Add materialView to UIViewController.
view.addSubview(pulseView)
pulseView.animate(MaterialAnimation.rotate(3, duration: 3))
UIView.animateWithDuration(0.4,
delay: 3,
usingSpringWithDamping: 0.6,
initialSpringVelocity: 0,
options: .AllowUserInteraction,
animations: {
pulseView.frame.origin.x = 300
}, completion: nil)
}
} }
...@@ -42,7 +42,8 @@ class ViewController: UIViewController { ...@@ -42,7 +42,8 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareGeneralMaterialViewExample() // prepareGeneralMaterialViewExample()
prepareMaterialViewAnimationExample()
} }
/// General preparation statements. /// General preparation statements.
...@@ -61,5 +62,26 @@ class ViewController: UIViewController { ...@@ -61,5 +62,26 @@ class ViewController: UIViewController {
// Add materialView to UIViewController. // Add materialView to UIViewController.
view.addSubview(materialView) view.addSubview(materialView)
} }
/// Prepares the MaterialView animation example.
private func prepareMaterialViewAnimationExample() {
let materialView: MaterialView = MaterialView(frame: CGRectMake(132, 132, 150, 150))
materialView.image = UIImage(named: "FocusAppIcon")
materialView.shape = .Square
materialView.depth = .Depth2
materialView.cornerRadius = .Radius3
// Add materialView to UIViewController.
view.addSubview(materialView)
UIView.animateWithDuration(0.4,
delay: 3,
usingSpringWithDamping: 0.6,
initialSpringVelocity: 0,
options: .AllowUserInteraction,
animations: {
materialView.frame.origin.x = 300
}, completion: nil)
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment