Commit 96cb8184 by Daniel Dahan

updated README to test new gif animations

parent e275fffc
...@@ -152,7 +152,7 @@ fileprivate extension CALayer { ...@@ -152,7 +152,7 @@ fileprivate extension CALayer {
} }
var anims = [CABasicAnimation]() var anims = [CABasicAnimation]()
var d = targetState.duration var duration = targetState.duration
if let v = targetState.backgroundColor { if let v = targetState.backgroundColor {
let a = MotionCAAnimation.background(color: UIColor(cgColor: v)) let a = MotionCAAnimation.background(color: UIColor(cgColor: v))
...@@ -262,11 +262,11 @@ fileprivate extension CALayer { ...@@ -262,11 +262,11 @@ fileprivate extension CALayer {
let a = MotionCAAnimation.convert(animation: v, stiffness: stiffness, damping: damping) let a = MotionCAAnimation.convert(animation: v, stiffness: stiffness, damping: damping)
anims[i] = a anims[i] = a
d = a.settlingDuration * 0.9 duration = a.settlingDuration
} }
} }
let g = Motion.animate(group: anims, duration: d) let g = Motion.animate(group: anims, duration: duration)
g.fillMode = MotionAnimationFillModeToValue(mode: .forwards) g.fillMode = MotionAnimationFillModeToValue(mode: .forwards)
g.isRemovedOnCompletion = false g.isRemovedOnCompletion = false
g.timingFunction = targetState.timingFunction g.timingFunction = targetState.timingFunction
...@@ -274,11 +274,12 @@ fileprivate extension CALayer { ...@@ -274,11 +274,12 @@ fileprivate extension CALayer {
s.animate(g) s.animate(g)
if let v = targetState.completion { if let v = targetState.completion {
Motion.delay(d, execute: v) print(duration)
Motion.delay(duration, execute: v)
} }
if let v = completion { if let v = completion {
Motion.delay(d, execute: v) Motion.delay(duration, execute: v)
} }
} }
} }
......
...@@ -780,12 +780,12 @@ extension Motion { ...@@ -780,12 +780,12 @@ extension Motion {
the animations have completed. the animations have completed.
*/ */
@discardableResult @discardableResult
public class func delay(_ time: TimeInterval, execute block: @escaping () -> Void) -> MotionDelayCancelBlock? { public class func delay(_ time: TimeInterval, execute: @escaping () -> Void) -> MotionDelayCancelBlock? {
var cancelable: MotionDelayCancelBlock? var cancelable: MotionDelayCancelBlock?
let delayed: MotionDelayCancelBlock = { let delayed: MotionDelayCancelBlock = {
if !$0 { if !$0 {
DispatchQueue.main.async(execute: block) DispatchQueue.main.async(execute: execute)
} }
cancelable = nil cancelable = 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