Skip to content

Commit 0ff3086

Browse files
committed
动画优化
1 parent 8b9dbaf commit 0ff3086

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

Coding_iOS/Vendor/PopMenu/PopMenu.m

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define MenuButtonHeight 110
1515
#define MenuButtonVerticalPadding 10
1616
#define MenuButtonHorizontalMargin 10
17-
#define MenuButtonAnimationTime 0.2
17+
#define MenuButtonAnimationTime 0.5
1818
#define MenuButtonAnimationInterval (MenuButtonAnimationTime / 5)
1919

2020
#define kMenuButtonBaseTag 100
@@ -59,13 +59,15 @@ - (void)setup {
5959
_realTimeBlur = [[XHRealTimeBlur alloc] initWithFrame:self.bounds];
6060
_realTimeBlur.blurStyle = XHBlurStyleTranslucentWhite;
6161
_realTimeBlur.showDuration = 0.3;
62-
_realTimeBlur.disMissDuration = 0.5;
62+
_realTimeBlur.disMissDuration = 1.0;
6363
_realTimeBlur.willShowBlurViewcomplted = ^(void) {
64+
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
6465
weakSelf.isShowed = YES;
6566
[weakSelf showButtons];
6667
};
6768

6869
_realTimeBlur.willDismissBlurViewCompleted = ^(void) {
70+
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
6971
[weakSelf hidenButtons];
7072
};
7173
_realTimeBlur.didDismissBlurViewCompleted = ^(BOOL finished) {
@@ -199,7 +201,8 @@ - (void)hidenButtons {
199201
default:
200202
break;
201203
}
202-
double delayInSeconds = (items.count - index) * MenuButtonAnimationInterval;
204+
// double delayInSeconds = (items.count - index) * MenuButtonAnimationInterval;
205+
double delayInSeconds = (items.count - index) * 0.05;
203206

204207
[self initailzerAnimationWithToPostion:toRect formPostion:fromRect atView:menuButton beginTime:delayInSeconds];
205208
}
@@ -233,8 +236,9 @@ - (CGRect)getFrameWithItemCount:(NSInteger)itemCount
233236
atIndex:(NSInteger)index
234237
onPage:(NSInteger)page {
235238

236-
NSUInteger rowCount = itemCount / perRowItemCount + (itemCount % perColumItemCount > 0 ? 1 : 0);
237-
CGFloat insetY = (CGRectGetHeight(self.bounds) - (itemHeight + paddingY) * rowCount) / 2.0;
239+
CGFloat insetY = kScreen_Height * 0.1 + 64;
240+
// NSUInteger rowCount = itemCount / perRowItemCount + (itemCount % perColumItemCount > 0 ? 1 : 0);
241+
// CGFloat insetY = (CGRectGetHeight(self.bounds) - (itemHeight + paddingY) * rowCount) / 2.0;
238242

239243
CGFloat originX = (index % perRowItemCount) * (itemWidth + paddingX) + paddingX + (page * CGRectGetWidth(self.bounds));
240244
CGFloat originY = ((index / perRowItemCount) - perColumItemCount * page) * (itemHeight + paddingY) + paddingY;
@@ -250,10 +254,10 @@ - (void)initailzerAnimationWithToPostion:(CGRect)toRect formPostion:(CGRect)from
250254
springAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame];
251255
springAnimation.removedOnCompletion = YES;
252256
springAnimation.beginTime = beginTime + CACurrentMediaTime();
253-
CGFloat springBounciness = 10 - beginTime * 2;
257+
CGFloat springBounciness = 15 - beginTime * 2;
254258
springAnimation.springBounciness = springBounciness; // value between 0-20
255259

256-
CGFloat springSpeed = 12 - beginTime * 2;
260+
CGFloat springSpeed = 6 - beginTime * 2;
257261
springAnimation.springSpeed = springSpeed; // value between 0-20
258262
springAnimation.toValue = [NSValue valueWithCGRect:toRect];
259263
springAnimation.fromValue = [NSValue valueWithCGRect:fromRect];

0 commit comments

Comments
 (0)