Skip to content

Commit

Permalink
Tweak animations.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-lyn committed Aug 2, 2016
1 parent 3295aab commit 35c0cb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions STPopup/STPopupController.m
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
else if (object == topViewController) {
if (topViewController.isViewLoaded && topViewController.view.superview) {
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
[self layoutContainerView];
} completion:nil];
}
Expand Down Expand Up @@ -338,7 +338,7 @@ - (void)transitFromViewController:(UIViewController *)fromViewController toViewC

_containerView.userInteractionEnabled = NO;
toViewController.view.alpha = 0;
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
[self layoutContainerView];
[_contentView addSubview:toViewController.view];
capturedView.alpha = 0;
Expand Down Expand Up @@ -416,7 +416,7 @@ - (void)updateNavigationBarAniamted:(BOOL)animated
_navigationBar.topItem.titleView = toTitleView;
toTitleView.alpha = 0;

[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
fromTitleView.alpha = 0;
toTitleView.alpha = 1;
} completion:^(BOOL finished) {
Expand Down Expand Up @@ -460,7 +460,7 @@ - (void)setNavigationBarHidden:(BOOL)navigationBarHidden animated:(BOOL)animated
if (!navigationBarHidden) {
_navigationBar.hidden = navigationBarHidden;
}
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
_navigationBar.alpha = navigationBarHidden ? 0 : 1;
[self layoutContainerView];
} completion:^(BOOL finished) {
Expand Down Expand Up @@ -605,11 +605,11 @@ - (void)setCornerRadius:(CGFloat)cornerRadius
- (void)orientationDidChange
{
[_containerView endEditing:YES];
[UIView animateWithDuration:0.2 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[UIView animateWithDuration:0.2 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
_containerView.alpha = 0;
} completion:^(BOOL finished) {
[self layoutContainerView];
[UIView animateWithDuration:0.2 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[UIView animateWithDuration:0.2 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
_containerView.alpha = 1;
} completion:nil];
}];
Expand Down Expand Up @@ -821,7 +821,7 @@ - (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionC
[UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0 options:UIViewAnimationOptionCurveEaseOut animations:animationBlock completion:completionBlock];
break;
case STPopupTransitionStyleSlideVertical:
[UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:animationBlock completion:completionBlock];
[UIView animateWithDuration:[self transitionDuration:transitionContext] delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:animationBlock completion:completionBlock];
break;
default:
break;
Expand Down Expand Up @@ -896,7 +896,7 @@ - (void)popupNavigationBar:(STPopupNavigationBar *)navigationBar touchDidEndWith
}
else {
[_containerView endEditing:YES];
[UIView animateWithDuration:0.4 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[UIView animateWithDuration:0.4 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
_containerView.transform = CGAffineTransformIdentity;
} completion:nil];
}
Expand Down
2 changes: 1 addition & 1 deletion STPopup/STPopupLeftBarItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ - (void)setType:(STPopupLeftBarItemType)type animated:(BOOL)animated
{
_type = type;
if (animated) {
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:1 initialSpringVelocity:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
[self updateLayout];
} completion:nil];
}
Expand Down

0 comments on commit 35c0cb9

Please sign in to comment.