Commit 80b03f9c by Daniel Dahan

updated MaterialView to better handle UIView animations

parent a3dba3f5
......@@ -40,10 +40,10 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
// prepareFlatButtonExample()
// prepareRaisedButtonExample()
// prepareFabButtonExample()
prepareFabButtonAnimationExample()
prepareFlatButtonExample()
prepareRaisedButtonExample()
prepareFabButtonExample()
// prepareFabButtonAnimationExample()
}
/// General preparation statements.
......@@ -96,7 +96,8 @@ class ViewController: UIViewController {
delay: 3,
usingSpringWithDamping: 0.6,
initialSpringVelocity: 0,
options: .AllowUserInteraction, animations: {
options: .AllowUserInteraction,
animations: {
button.frame.origin.x = 300
}, completion: nil)
}
......
......@@ -41,7 +41,8 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareGeneralMaterialPulseViewExample()
// prepareGeneralMaterialPulseViewExample()
prepareMaterialPulseViewAnimationExample()
}
/// General preparation statements.
......@@ -60,5 +61,28 @@ class ViewController: UIViewController {
// Add pulseView to UIViewController.
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 {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareGeneralMaterialViewExample()
// prepareGeneralMaterialViewExample()
prepareMaterialViewAnimationExample()
}
/// General preparation statements.
......@@ -61,5 +62,26 @@ class ViewController: UIViewController {
// Add materialView to UIViewController.
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