Sfoglia il codice sorgente

added interpolation and startDelay for animations

yogevbd 6 anni fa
parent
commit
0355a61a3b

+ 1
- 1
lib/ios/RNNModalAnimation.m Vedi File

@@ -29,7 +29,7 @@
29 29
 	[_screenTransition.topBar setupInitialTransitionForView:toViewController.navigationController.navigationBar];
30 30
 	
31 31
 	
32
-	[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
32
+	[UIView animateWithDuration:[self transitionDuration:transitionContext] delay:self.screenTransition.content.startDelay options:self.screenTransition.content.interpolation animations:^{
33 33
 		[_screenTransition.content completeTransitionForView:toViewController.view];
34 34
 		[_screenTransition.topBar completeTransitionForView:toViewController.navigationController.navigationBar];
35 35
 	} completion:^(BOOL finished) {

+ 4
- 2
lib/ios/RNNPushAnimation.m Vedi File

@@ -10,7 +10,7 @@
10 10
 }
11 11
 
12 12
 - (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext {
13
-	return 0.5;
13
+	return self.screenTransition.content.duration;
14 14
 }
15 15
 
16 16
 - (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext {
@@ -20,11 +20,13 @@
20 20
 	
21 21
 	[self.screenTransition.content setupInitialTransitionForView:toViewController.view];
22 22
 	[self.screenTransition.topBar setupInitialTransitionForView:toViewController.navigationController.navigationBar];
23
+	[self.screenTransition.bottomTabs setupInitialTransitionForView:toViewController.tabBarController.tabBar];
23 24
 	
24 25
 	
25
-	[UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
26
+	[UIView animateWithDuration:[self transitionDuration:transitionContext] delay:self.screenTransition.content.startDelay options:self.screenTransition.content.interpolation animations:^{
26 27
 		[self.screenTransition.content completeTransitionForView:toViewController.view];
27 28
 		[self.screenTransition.topBar completeTransitionForView:toViewController.navigationController.navigationBar];
29
+		[self.screenTransition.bottomTabs completeTransitionForView:toViewController.tabBarController.tabBar];
28 30
 	} completion:^(BOOL finished) {
29 31
 		[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
30 32
 	}];

+ 1
- 0
lib/ios/RNNTransitionStateHolder.h Vedi File

@@ -18,6 +18,7 @@
18 18
 @property (nonatomic) double endY;
19 19
 @property (nonatomic) double startX;
20 20
 @property (nonatomic) double endX;
21
+@property (nonatomic) UIViewAnimationOptions interpolation;
21 22
 
22 23
 - (instancetype)initWithTransition:(NSDictionary*)transition;
23 24
 

+ 12
- 0
lib/ios/RNNTransitionStateHolder.m Vedi File

@@ -25,10 +25,22 @@
25 25
 	self.fromId = [transition objectForKey:@"fromId"];
26 26
 	self.toId = [transition objectForKey:@"toId"];
27 27
 	self.isSharedElementTransition = [[transition objectForKey:@"type"] isEqualToString:@"sharedElement"];
28
+	self.interpolation = [self animationOptionsFromString:transition[@"interpolation"]];
29
+	
28 30
 	
29 31
 	return self;
30 32
 }
31 33
 
34
+- (UIViewAnimationOptions)animationOptionsFromString:(NSString*)interpolationString {
35
+	if ([interpolationString isEqualToString:@"accelerate"]) {
36
+		return UIViewAnimationOptionCurveEaseIn;
37
+	} else if ([interpolationString isEqualToString:@"decelerate"]) {
38
+		return UIViewAnimationOptionCurveEaseOut;
39
+	}
40
+	
41
+	return UIViewAnimationOptionCurveEaseInOut;
42
+}
43
+
32 44
 - (void)setupInitialTransitionForView:(UIView*)view {
33 45
 	_initialFrame = view.frame;
34 46
 	view.alpha = self.startAlpha;