Skip to content

Commit

Permalink
Merge pull request #4 from shu223/2_background-support
Browse files Browse the repository at this point in the history
background support
  • Loading branch information
shu223 committed May 27, 2016
2 parents 4f854f2 + a3924e3 commit 4596366
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Pulsator.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "Pulsator"
s.version = "0.1.0"
s.version = "0.1.1"
s.summary = "Pulse animation for iOS."
s.homepage = "https://github.com/shu223/Pulsator"
s.screenshots = "https://github.com/shu223/Pulsator/blob/master/demo.gif?raw=true"
s.license = 'MIT'
s.author = { "shu223" => "[email protected]" }
s.source = { :git => "https://github.com/shu223/Pulsator.git", :tag => "0.1.0" }
s.source = { :git => "https://github.com/shu223/Pulsator.git", :tag => "0.1.1" }
s.social_media_url = 'https://twitter.com/shu223'

s.platform = :ios, '8.0'
Expand Down
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 4596366

Please sign in to comment.