react-native-navigation的迁移库

FloatTransition.m 1.2KB

1234567891011121314151617181920212223242526272829303132
  1. #import "FloatTransition.h"
  2. @implementation FloatTransition
  3. - (instancetype)initWithView:(UIView *)view transitionDetails:(TransitionDetailsOptions *)transitionDetails {
  4. self = [self initWithView:view
  5. from:transitionDetails.from
  6. to:transitionDetails.to
  7. startDelay:[transitionDetails.startDelay getWithDefaultValue:0]
  8. duration:[transitionDetails.duration getWithDefaultValue:[self defaultDuration]]
  9. interpolation:[transitionDetails.interpolation getWithDefaultValue:@"accelerateDecelerate"]];
  10. return self;
  11. }
  12. - (instancetype)initWithView:(UIView *)view from:(Double*)from to:(Double*)to startDelay:(NSTimeInterval)startDelay duration:(NSTimeInterval)duration interpolation:(Text *)interpolation {
  13. self = [super initWithView:view startDelay:startDelay duration:duration interpolation:interpolation];
  14. _initialValue = self.initialValue;
  15. _from = [self calculateFrom:from];
  16. _to = [self calculateTo:to];
  17. return self;
  18. }
  19. - (CGFloat)calculateFrom:(Double*)from {
  20. return from.hasValue ? from.get : _initialValue;
  21. }
  22. - (CGFloat)calculateTo:(Double*)to {
  23. return to.hasValue ? to.get : _initialValue;
  24. }
  25. @end