Commit 3e1cdccc by danieldahan

updated MaterialAnimation method name

parent 4d0765c9
...@@ -54,13 +54,13 @@ public struct MaterialAnimation { ...@@ -54,13 +54,13 @@ public struct MaterialAnimation {
:name: animationDisabled :name: animationDisabled
*/ */
public static func animationDisabled(animations: (() -> Void)) { public static func animationDisabled(animations: (() -> Void)) {
animationWithDuration(0, animations: animations) animateWithDuration(0, animations: animations)
} }
/** /**
:name: animationWithDuration :name: animateWithDuration
*/ */
public static func animationWithDuration(duration: CFTimeInterval, animations: (() -> Void), options: UIViewAnimationOptions? = nil, completion: (() -> Void)? = nil) { public static func animateWithDuration(duration: CFTimeInterval, animations: (() -> Void), options: UIViewAnimationOptions? = nil, completion: (() -> Void)? = nil) {
CATransaction.begin() CATransaction.begin()
CATransaction.setAnimationDuration(duration) CATransaction.setAnimationDuration(duration)
CATransaction.setCompletionBlock(completion) CATransaction.setCompletionBlock(completion)
......
...@@ -505,7 +505,7 @@ public class MaterialButton : UIButton { ...@@ -505,7 +505,7 @@ public class MaterialButton : UIButton {
let s: CGFloat = 1 let s: CGFloat = 1
if nil != pulseColor && 0 < pulseColorOpacity { if nil != pulseColor && 0 < pulseColorOpacity {
MaterialAnimation.animationWithDuration(t, animations: { MaterialAnimation.animateWithDuration(t, animations: {
self.pulseLayer.hidden = true self.pulseLayer.hidden = true
}) })
pulseLayer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil) pulseLayer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil)
......
...@@ -414,7 +414,7 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell { ...@@ -414,7 +414,7 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell {
MaterialAnimation.animationDisabled { MaterialAnimation.animationDisabled {
self.pulseLayer.bounds = CGRectMake(0, 0, 2 * w, 2 * h) self.pulseLayer.bounds = CGRectMake(0, 0, 2 * w, 2 * h)
} }
MaterialAnimation.animationWithDuration(t, animations: { MaterialAnimation.animateWithDuration(t, animations: {
self.pulseLayer.hidden = false self.pulseLayer.hidden = false
}) })
} }
...@@ -507,7 +507,7 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell { ...@@ -507,7 +507,7 @@ public class MaterialPulseCollectionViewCell : UICollectionViewCell {
let s: CGFloat = 1 let s: CGFloat = 1
if nil != pulseColor && 0 < pulseColorOpacity { if nil != pulseColor && 0 < pulseColorOpacity {
MaterialAnimation.animationWithDuration(t, animations: { MaterialAnimation.animateWithDuration(t, animations: {
self.pulseLayer.hidden = true self.pulseLayer.hidden = true
}) })
pulseLayer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil) pulseLayer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil)
......
...@@ -183,7 +183,7 @@ public class MaterialPulseView : MaterialView { ...@@ -183,7 +183,7 @@ public class MaterialPulseView : MaterialView {
let s: CGFloat = 1 let s: CGFloat = 1
if nil != pulseColor && 0 < pulseColorOpacity { if nil != pulseColor && 0 < pulseColorOpacity {
MaterialAnimation.animationWithDuration(t, animations: { MaterialAnimation.animateWithDuration(t, animations: {
self.pulseLayer.hidden = true self.pulseLayer.hidden = true
}) })
pulseLayer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil) pulseLayer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil)
......
...@@ -183,7 +183,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -183,7 +183,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
let w: CGFloat = (hidden ? -width : width) / 2 let w: CGFloat = (hidden ? -width : width) / 2
if animated { if animated {
MaterialAnimation.animationWithDuration(0.25, animations: { MaterialAnimation.animateWithDuration(0.25, animations: {
self.sideView.width = width self.sideView.width = width
self.sideView.position.x = w self.sideView.position.x = w
}) { }) {
...@@ -210,7 +210,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -210,7 +210,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
public func open(velocity: CGFloat = 0) { public func open(velocity: CGFloat = 0) {
toggleStatusBar(true) toggleStatusBar(true)
backdropLayer.hidden = false backdropLayer.hidden = false
MaterialAnimation.animationWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(sideView.x / velocity)))), MaterialAnimation.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(sideView.x / velocity)))),
animations: { animations: {
self.sideView.position = CGPointMake(self.sideView.width / 2, self.sideView.height / 2) self.sideView.position = CGPointMake(self.sideView.width / 2, self.sideView.height / 2)
}) { }) {
...@@ -224,7 +224,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -224,7 +224,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
public func close(velocity: CGFloat = 0) { public func close(velocity: CGFloat = 0) {
toggleStatusBar(false) toggleStatusBar(false)
backdropLayer.hidden = true backdropLayer.hidden = true
MaterialAnimation.animationWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(sideView.x / velocity)))), MaterialAnimation.animateWithDuration(Double(0 == velocity ? animationDuration : fmax(0.1, fmin(1, Double(sideView.x / velocity)))),
animations: { animations: {
self.sideView.position = CGPointMake(-self.sideView.width / 2, self.sideView.height / 2) self.sideView.position = CGPointMake(-self.sideView.width / 2, self.sideView.height / 2)
}) { }) {
......
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