123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #import "ElementAnimator.h"
- #import "ElementAlphaTransition.h"
- #import "ElementVerticalTransition.h"
- #import "ElementHorizontalTransition.h"
- #import "HorizontalTranslationTransition.h"
- #import "VerticalTranslationTransition.h"
- #import "Transition.h"
- #import "RNNElementFinder.h"
- #import "VerticalRotationTransition.h"
-
- @implementation ElementAnimator {
- UIViewController* _toVC;
- UIViewController* _fromVC;
- UIView* _containerView;
- }
-
- - (instancetype)initWithTransitionOptions:(ElementTransitionOptions *)transitionOptions view:(UIView *)view fromVC:(UIViewController *)fromVC toVC:(UIViewController *)toVC containerView:(UIView *)containerView {
- self = [super init];
- _fromVC = fromVC;
- _toVC = toVC;
- _containerView = containerView;
- self.view = view;
- self.animations = [self createAnimations:transitionOptions];
- return self;
- }
-
- - (NSMutableArray<id<DisplayLinkAnimation>> *)createAnimations:(ElementTransitionOptions *)transitionOptions {
- NSMutableArray* animations = [NSMutableArray new];
- if (transitionOptions.alpha.hasAnimation) {
- [animations addObject:[[ElementAlphaTransition alloc] initWithView:self.view transitionDetails:transitionOptions.alpha]];
- }
-
- if (transitionOptions.x.hasAnimation) {
- [animations addObject:[[ElementHorizontalTransition alloc] initWithView:self.view transitionDetails:transitionOptions.x]];
- }
-
- if (transitionOptions.y.hasAnimation) {
- [animations addObject:[[ElementVerticalTransition alloc] initWithView:self.view transitionDetails:transitionOptions.y]];
- }
-
- if (transitionOptions.translationX.hasAnimation) {
- [animations addObject:[[HorizontalTranslationTransition alloc] initWithView:self.view transitionDetails:transitionOptions.translationX]];
- }
-
- if (transitionOptions.translationY.hasAnimation) {
- [animations addObject:[[VerticalTranslationTransition alloc] initWithView:self.view transitionDetails:transitionOptions.translationY]];
- }
-
- if (transitionOptions.rotationY.hasAnimation) {
- [animations addObject:[[VerticalRotationTransition alloc] initWithView:self.view transitionDetails:transitionOptions.rotationY]];
- }
-
- return animations;
- }
-
- @end
|