Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
*.xcuserstate
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xccheckout
xcuserdata
Podfile.lock
*.xcscmblueprint

Pods
2 changes: 2 additions & 0 deletions SSBouncyButton/SSBouncyButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ static CGFloat SSBouncyButtonDefaultCornerRadius = 3;
@interface SSBouncyButton : UIButton

@property (nonatomic, assign) CGFloat cornerRadius;
@property (nonatomic, assign) CGFloat increaseRate;
@property (nonatomic, assign) CGFloat decreaseRate;

@end
20 changes: 12 additions & 8 deletions SSBouncyButton/SSBouncyButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ -(id)initWithCoder:(NSCoder *)aDecoder{
if(self){
self.adjustsImageWhenHighlighted = NO;
self.cornerRadius = SSBouncyButtonDefaultCornerRadius;
self.increaseRate = 1.0f;
self.decreaseRate = 1.0f;
[self setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
[self setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected | UIControlStateHighlighted];
}
Expand All @@ -79,6 +81,8 @@ - (id)initWithFrame:(CGRect)frame
self.tintColor = [UIColor colorWithHex:SSBouncyButtonDefaultTintColor];
self.cornerRadius = SSBouncyButtonDefaultCornerRadius;
self.titleLabel.font = [UIFont systemFontOfSize:SSBouncyButtonDefaultTitleLabelFontSize];
self.increaseRate = 1.0f;
self.decreaseRate = 1.0f;
[self setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
[self setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected | UIControlStateHighlighted];
}
Expand Down Expand Up @@ -176,21 +180,21 @@ - (void)beginShrinkAnimation
BRYSerialAnimationQueue *queue = [[BRYSerialAnimationQueue alloc] init];
[queue animateWithDuration:0.3 animations:^{
self.isShrinking = YES;
self.transform = CGAffineTransformMakeScale(0.83, 0.83);
self.transform = CGAffineTransformMakeScale(0.83 * self.decreaseRate, 0.83 * self.decreaseRate);
}];
[queue animateWithDuration:0.2 animations:^{
if (self.touchEnded) {
self.isShrinking = NO;
return;
}
self.transform = CGAffineTransformMakeScale(0.86, 0.86);
self.transform = CGAffineTransformMakeScale(0.86 * self.decreaseRate, 0.86 * self.decreaseRate);
}];
[queue animateWithDuration:0.18 animations:^{
if (self.touchEnded) {
self.isShrinking = NO;
return;
}
self.transform = CGAffineTransformMakeScale(0.85, 0.85);
self.transform = CGAffineTransformMakeScale(0.85 * self.decreaseRate, 0.85 * self.decreaseRate);
} completion:^(BOOL finished) {
self.isShrinking = NO;
}];
Expand All @@ -208,21 +212,21 @@ - (void)beginEnlargeAnimation
CALayer *presentationLayer = self.layer.presentationLayer;
self.transform = CATransform3DGetAffineTransform(presentationLayer.transform);
[queue animateWithDuration:0.1 animations:^{
self.transform = CGAffineTransformMakeScale(0.85, 0.85);
self.transform = CGAffineTransformMakeScale(0.85 * self.decreaseRate, 0.85 * self.decreaseRate);
}];
} else {
[queue animateWithDuration:0.1 animations:^{
self.transform = CGAffineTransformMakeScale(0.85, 0.85);
self.transform = CGAffineTransformMakeScale(0.85 * self.decreaseRate, 0.85 * self.decreaseRate);
}];
}
[queue animateWithDuration:0.18 animations:^{
self.transform = CGAffineTransformMakeScale(1.05, 1.05);
self.transform = CGAffineTransformMakeScale(1.05 * self.increaseRate, 1.05 * self.increaseRate);
}];
[queue animateWithDuration:0.18 animations:^{
self.transform = CGAffineTransformMakeScale(0.98, 0.98);
self.transform = CGAffineTransformMakeScale(0.98 * self.decreaseRate, 0.98 * self.decreaseRate);
}];
[queue animateWithDuration:0.17 animations:^{
self.transform = CGAffineTransformMakeScale(1.01, 1.01);
self.transform = CGAffineTransformMakeScale(1.01 * self.increaseRate, 1.01 * self.increaseRate);
}];
[queue animateWithDuration:0.17 animations:^{
self.transform = CGAffineTransformIdentity;
Expand Down
16 changes: 13 additions & 3 deletions SSBouncyButtonDemo/Podfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
pod 'BRYSerialAnimationQueue', '~> 1.0'
pod 'UIColor-Hex'
pod 'UIImage+BetterAdditions', '~> 2.0'
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'SSBouncyButtonDemo' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!

# Pods for SSBouncyButtonDemo
pod 'BRYSerialAnimationQueue', '~> 1.0'
pod 'UIColor-Hex'
pod 'UIImage+BetterAdditions', '~> 2.0'

end
18 changes: 18 additions & 0 deletions SSBouncyButtonDemo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PODS:
- BRYSerialAnimationQueue (1.0.0)
- UIColor-Hex (0.1.1)
- UIImage+BetterAdditions (2.0.3)

DEPENDENCIES:
- BRYSerialAnimationQueue (~> 1.0)
- UIColor-Hex
- UIImage+BetterAdditions (~> 2.0)

SPEC CHECKSUMS:
BRYSerialAnimationQueue: 75feef56345338619a6c2111f2a81de28a59c368
UIColor-Hex: 77e80f383c6b3a63c5e95a9a4a7f4a71976e38a5
UIImage+BetterAdditions: 185cbe06059747dd4a65562c1b0c560e761d030c

PODFILE CHECKSUM: c31b450762388b66e38d357eb8efff1d75eb2ae4

COCOAPODS: 1.0.0

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion SSBouncyButtonDemo/Pods/Headers/UIColor-Hex/UIColor+Hex.h

This file was deleted.

This file was deleted.

12 changes: 7 additions & 5 deletions SSBouncyButtonDemo/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

5 changes: 0 additions & 5 deletions SSBouncyButtonDemo/Pods/Pods-BRYSerialAnimationQueue-dummy.m

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions SSBouncyButtonDemo/Pods/Pods-UIColor-Hex-Private.xcconfig

This file was deleted.

5 changes: 0 additions & 5 deletions SSBouncyButtonDemo/Pods/Pods-UIColor-Hex-dummy.m

This file was deleted.

5 changes: 0 additions & 5 deletions SSBouncyButtonDemo/Pods/Pods-UIColor-Hex-prefix.pch

This file was deleted.

Empty file.

This file was deleted.

5 changes: 0 additions & 5 deletions SSBouncyButtonDemo/Pods/Pods-UIImage+BetterAdditions-dummy.m

This file was deleted.

This file was deleted.

This file was deleted.

76 changes: 0 additions & 76 deletions SSBouncyButtonDemo/Pods/Pods-acknowledgements.markdown

This file was deleted.

Loading