Created
April 9, 2014 13:59
-
-
Save jverkoey/10273823 to your computer and use it in GitHub Desktop.
iOS 7 spring damping and stiffness calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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