Skip to content

Commit

Permalink
- Enabled to change duration dynamically
Browse files Browse the repository at this point in the history
- Updated demo & README
  • Loading branch information
shu223 committed Oct 19, 2015
1 parent 6a1098f commit f1585e9
Show file tree
Hide file tree
Showing 23 changed files with 409 additions and 185 deletions.
4 changes: 2 additions & 2 deletions PulsingHalo.podspec
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "PulsingHalo"
s.version = "0.0.5"
s.version = "0.0.6"
s.summary = "iOS Component For Creating A Pulsing Animation Great For Map Annotations And Beacons"
s.homepage = "https://github.com/shu223/PulsingHalo"
s.license = 'MIT'
s.author = { "shu223" => "shuichi0526@gmail.com" }
s.platform = :ios
s.source = { :git => "https://github.com/shu223/PulsingHalo.git", :tag => "0.0.5" }
s.source = { :git => "https://github.com/shu223/PulsingHalo.git", :tag => "0.0.6" }
s.source_files = 'PulsingHalo/*.{h,m}'
s.framework = 'QuartzCore'
s.requires_arc = true
Expand Down
18 changes: 16 additions & 2 deletions PulsingHalo/PulsingHaloLayer.m
Expand Up @@ -62,6 +62,7 @@ - (instancetype)init {
return [self initWithRepeatCount:INFINITY];
}


// =============================================================================
#pragma mark - Accessor

Expand Down Expand Up @@ -109,8 +110,21 @@ - (void)setStartInterval:(NSTimeInterval)startInterval {
self.instanceDelay = startInterval;
}

- (void)setAnimationDuration:(NSTimeInterval)animationDuration {

_animationDuration = animationDuration;
self.animationGroup.duration = animationDuration + self.pulseInterval;
for (CAAnimation *anAnimation in self.animationGroup.animations) {
anAnimation.duration = animationDuration;
}
[self.effect removeAllAnimations];
[self.effect addAnimation:self.animationGroup forKey:@"pulse"];
self.instanceDelay = (self.animationDuration + self.pulseInterval) / self.haloLayerNumber;
}


// =============================================================================
#pragma mark - private
#pragma mark - Private

- (void)_setupProperties {
_fromValueForRadius = 0.0;
Expand All @@ -123,7 +137,7 @@ - (void)_setupProperties {
self.radius = 60;
self.haloLayerNumber = 1;
self.startInterval = 1;
self.backgroundColor = [[UIColor colorWithRed:0.000 green:0.478 blue:1.000 alpha:1] CGColor];
self.backgroundColor = [[UIColor colorWithRed:0.000 green:0.455 blue:0.756 alpha:1] CGColor];
}

- (void)_setupAnimationGroup {
Expand Down
14 changes: 9 additions & 5 deletions PulsingHaloDemo.xcodeproj/project.pbxproj
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
8A76D79E1BD4CC6B00C3881D /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8A76D79D1BD4CC6B00C3881D /* Launch Screen.storyboard */; settings = {ASSET_TAGS = (); }; };
8AC907151850659E00A74F2E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AC907141850659E00A74F2E /* Foundation.framework */; };
8AC907171850659E00A74F2E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AC907161850659E00A74F2E /* CoreGraphics.framework */; };
8AC907191850659E00A74F2E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8AC907181850659E00A74F2E /* UIKit.framework */; };
Expand Down Expand Up @@ -35,6 +36,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
8A76D79D1BD4CC6B00C3881D /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
8AC907111850659E00A74F2E /* PulsingHaloDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PulsingHaloDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
8AC907141850659E00A74F2E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
8AC907161850659E00A74F2E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -116,13 +118,14 @@
8AC9071A1850659E00A74F2E /* PulsingHaloDemo */ = {
isa = PBXGroup;
children = (
8AC9071B1850659E00A74F2E /* Supporting Files */,
8AC9072C1850659E00A74F2E /* Images.xcassets */,
8AC907261850659E00A74F2E /* Main.storyboard */,
8A76D79D1BD4CC6B00C3881D /* Launch Screen.storyboard */,
8AC907231850659E00A74F2E /* AppDelegate.h */,
8AC907241850659E00A74F2E /* AppDelegate.m */,
8AC907261850659E00A74F2E /* Main.storyboard */,
8AC907291850659E00A74F2E /* ViewController.h */,
8AC9072A1850659E00A74F2E /* ViewController.m */,
8AC9072C1850659E00A74F2E /* Images.xcassets */,
8AC9071B1850659E00A74F2E /* Supporting Files */,
);
path = PulsingHaloDemo;
sourceTree = "<group>";
Expand Down Expand Up @@ -243,6 +246,7 @@
files = (
8AC9072D1850659E00A74F2E /* Images.xcassets in Resources */,
8AC9071F1850659E00A74F2E /* InfoPlist.strings in Resources */,
8A76D79E1BD4CC6B00C3881D /* Launch Screen.storyboard in Resources */,
8AC907281850659E00A74F2E /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -394,7 +398,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PulsingHaloDemo/PulsingHaloDemo-Prefix.pch";
INFOPLIST_FILE = "PulsingHaloDemo/PulsingHaloDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
PRODUCT_BUNDLE_IDENTIFIER = "Shuichi-Tsutsumi.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
Expand All @@ -409,7 +413,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PulsingHaloDemo/PulsingHaloDemo-Prefix.pch";
INFOPLIST_FILE = "PulsingHaloDemo/PulsingHaloDemo-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
PRODUCT_BUNDLE_IDENTIFIER = "Shuichi-Tsutsumi.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
Expand Down

0 comments on commit f1585e9

Please sign in to comment.