Skip to content

Instantly share code, notes, and snippets.

@jverkoey
Created April 9, 2014 13:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jverkoey/10273823 to your computer and use it in GitHub Desktop.
Save jverkoey/10273823 to your computer and use it in GitHub Desktop.
iOS 7 spring damping and stiffness calculation
@interface NSObject ()
- (void)generateSpringPropertiesForDuration:(float)arg1 damping:(float)arg2 velocity:(float)arg3;
- (id)_defaultAnimationForKey:(id)arg1;
@end
// This object calculates the damping and stiffness coefficients, given a damping value (0...1], a velocity, and a duration.
id obj = [[NSClassFromString(@"UIViewSpringAnimationState") alloc] init];
[obj generateSpringPropertiesForDuration:10 damping:0.5 velocity:10];
// Prints the calculated damping and stiffness coefficients.
NSLog(@"%@", [[obj _defaultAnimationForKey:@"test"] debugDescription]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment