Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9f41a1e

Browse files
点赞动画
1 parent eb4305b commit 9f41a1e

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

‎Coding_iOS/Coding_iOS-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>3.2</string>
20+
<string>3.2.5</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleURLTypes</key>
@@ -36,7 +36,7 @@
3636
</dict>
3737
</array>
3838
<key>CFBundleVersion</key>
39-
<string>3.2.201508290030</string>
39+
<string>3.2.5.201509091900</string>
4040
<key>LSRequiresIPhoneOS</key>
4141
<true/>
4242
<key>NSAppTransportSecurity</key>

‎Coding_iOS/Util/OC_Category/UIButton+Common.m

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,34 @@ - (void)animateToImage:(NSString *)imageName{
141141
imageV.frame = vFrame;
142142
[superV addSubview:imageV];
143143

144-
//animate and remove subview
145-
[NSObject pop_animate:^{
146-
CGPoint centerP = imageV.center;
147-
centerP.x += CGRectGetWidth(self.frame) /2;
148-
centerP.y -= CGRectGetHeight(self.frame) *2;
149-
imageV.pop_springSpeed = 1.0;
150-
imageV.pop_spring.center = centerP;
151-
imageV.layer.pop_rotation = M_PI_4/2;
152-
imageV.pop_spring.pop_scaleXY = CGPointMake(2.0, 2.0);
153-
imageV.pop_spring.alpha = 0.0;
154-
} completion:^(BOOL finished) {
155-
[imageV removeFromSuperview];
144+
//animate
145+
CGAffineTransform fromTransform = imageV.transform;
146+
CGPoint fromCenter = imageV.center;
147+
CGFloat dx = CGRectGetWidth(self.frame) /2;
148+
CGFloat dy = CGRectGetHeight(self.frame) *3;
149+
CGFloat dScale = 3.0;
150+
CGFloat dRotation = M_PI_4;
151+
152+
NSTimeInterval moveDurarion = 1.0;
153+
POPCustomAnimation *moveA = [POPCustomAnimation animationWithBlock:^BOOL(id target, POPCustomAnimation *animation) {
154+
float time_percent = (animation.currentTime - animation.beginTime)/moveDurarion;
155+
UIView *view = (UIView *)target;
156+
CGPoint toCenter = CGPointMake(fromCenter.x + time_percent * dx, fromCenter.y - (dy * time_percent * (2 - time_percent)));//抛物线移动
157+
view.center = toCenter;
158+
159+
CGAffineTransform toTransform = fromTransform;
160+
toTransform = CGAffineTransformTranslate(toTransform, 50, -50);
161+
162+
CGFloat toScale = 1 + time_percent *(dScale - 1);//线性放大
163+
toTransform = CGAffineTransformMakeScale(toScale, toScale);
164+
CGFloat toRotation = dRotation * (1- cosf(time_percent * M_PI_2));//cos曲线旋转(先慢后快)
165+
toTransform = CGAffineTransformRotate(toTransform, toRotation);
166+
view.transform = toTransform;
167+
168+
view.alpha = 1 - time_percent;
169+
return time_percent < 1.0;
156170
}];
171+
[imageV pop_addAnimation:moveA forKey:@"animateToImage"];
157172
}
158173
}
159174
@end

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /