react-native-navigation的迁移库

FloatTransition.m 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 fromFloat:(CGFloat)from toFloat:(CGFloat)to startDelay:(NSTimeInterval)startDelay duration:(NSTimeInterval)duration interpolation:(Text *)interpolation {
  13. self = [super initWithView:view startDelay:startDelay duration:duration interpolation:interpolation];
  14. self.from = from;
  15. self.to = to;
  16. return self;
  17. }
  18. - (instancetype)initWithView:(UIView *)view from:(Double*)from to:(Double*)to startDelay:(NSTimeInterval)startDelay duration:(NSTimeInterval)duration interpolation:(Text *)interpolation {
  19. self = [super initWithView:view startDelay:startDelay duration:duration interpolation:interpolation];
  20. _initialValue = self.initialValue;
  21. _from = [self calculateFrom:from];
  22. _to = [self calculateTo:to];
  23. return self;
  24. }
  25. - (CGFloat)calculateFrom:(Double*)from {
  26. return from.hasValue ? from.get : _initialValue;
  27. }
  28. - (CGFloat)calculateTo:(Double*)to {
  29. return to.hasValue ? to.get : _initialValue;
  30. }
  31. @end