Skip to content

Commit

Permalink
Background support when it was stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
shu223 committed May 27, 2016
1 parent 4f854f2 commit 692b221
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Pulsator/Pulsator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Pulsator: CAReplicatorLayer {
pulse.backgroundColor = backgroundColor
let oldAlpha = alpha
alpha = CGColorGetAlpha(backgroundColor)
if animationGroup != nil && alpha != oldAlpha {
if alpha != oldAlpha {
recreate()
}
}
Expand Down Expand Up @@ -83,9 +83,7 @@ public class Pulsator: CAReplicatorLayer {
/// The value of this property should be ranging from @c 0 to @c 1 (exclusive).
public var keyTimeForHalfOpacity: Float = 0.2 {
didSet {
if animationGroup != nil {
recreate()
}
recreate()
}
}

Expand Down Expand Up @@ -179,6 +177,7 @@ public class Pulsator: CAReplicatorLayer {
// MARK: - Internal Methods

internal func recreate() {
guard animationGroup != nil else { return } // Not need to be recreated.
stop()
let when = dispatch_time(DISPATCH_TIME_NOW, Int64(0.2 * double_t(NSEC_PER_SEC)))
dispatch_after(when, dispatch_get_main_queue()) { () -> Void in
Expand Down

0 comments on commit 692b221

Please sign in to comment.