Created
April 5, 2010 20:37
-
-
Save simonwhitaker/356845 to your computer and use it in GitHub Desktop.
A simple Objective-C program to show the control point values for the constants in the CAMediaTimingFunction class
This file contains hidden or 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
/* | |
show-constants.m | |
Show the control point values for the CAMediaTimingFunction class constants | |
To compile: | |
clang -framework QuartzCore -framework Foundation show-constants.m -o show-constants | |
*/ | |
#import <QuartzCore/QuartzCore.h> | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSArray* functions = @[ | |
kCAMediaTimingFunctionLinear, | |
kCAMediaTimingFunctionEaseIn, | |
kCAMediaTimingFunctionEaseOut, | |
kCAMediaTimingFunctionEaseInEaseOut, | |
kCAMediaTimingFunctionDefault, | |
]; | |
float coords[2]; | |
for (id obj in functions) { | |
NSString* function_name = (NSString*) obj; | |
CAMediaTimingFunction* func = [CAMediaTimingFunction functionWithName:function_name]; | |
printf("%-13s ", [function_name cStringUsingEncoding:NSUTF8StringEncoding]); | |
for (int i = 0; i <= 3; i++) { | |
[func getControlPointAtIndex:i values:coords]; | |
printf("(%.2f, %.2f)%s", coords[0], coords[1], i < 3 ? ", " : "\n"); | |
} | |
} | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment