Commit 4e7853bc by Daniel Dahan

experimental: updated animation to use view rather than layer as parameter value

parent f49942a7
...@@ -22,11 +22,11 @@ public struct MaterialAnimation { ...@@ -22,11 +22,11 @@ public struct MaterialAnimation {
/** /**
:name: spin :name: spin
*/ */
public static func spin(layer: CALayer, duration: CFTimeInterval, rotations: Int = 1, completion: (() -> Void)? = nil) { public static func spin(view: UIView, duration: CFTimeInterval, rotations: Int = 1, completion: (() -> Void)? = nil) {
let a: CABasicAnimation = CABasicAnimation() let a: CABasicAnimation = CABasicAnimation()
a.keyPath = "transform.rotation" a.keyPath = "transform.rotation"
a.duration = duration a.duration = duration
a.byValue = M_PI * 2 * Double(rotations) a.byValue = M_PI * 2 * Double(rotations)
layer.addAnimation(a, forKey: nil) view.layer.addAnimation(a, forKey: 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