react-native-navigation的迁移库

RNNAnimationOptions.m 731B

123456789101112131415161718192021222324252627282930313233
  1. #import "RNNAnimationOptions.h"
  2. #define DEFAULT_DURATION @(0.7)
  3. #define DEFAULT_SPRING_VELOCITY @(0.8)
  4. #define DEFAULT_SPRING_DAMPING @(0.85)
  5. @implementation RNNAnimationOptions
  6. - (instancetype)initWithDict:(NSDictionary *)dict {
  7. self = [super init];
  8. self.animations = dict[@"animations"];
  9. self.duration = dict[@"duration"];
  10. self.springDamping = dict[@"springDamping"];
  11. self.springVelocity = dict[@"springVelocity"];
  12. return self;
  13. }
  14. - (NSNumber *)duration {
  15. return _duration ? _duration : DEFAULT_DURATION;
  16. }
  17. - (NSNumber *)springVelocity {
  18. return _springVelocity ? _springVelocity : DEFAULT_SPRING_VELOCITY;
  19. }
  20. - (NSNumber *)springDamping {
  21. return _springDamping ? _springDamping : DEFAULT_SPRING_DAMPING;
  22. }
  23. @end